Index question

erickroco9611

New Member
You are forcing the selection of the po-index index. Why? When did you suddenly become smarter than the compiler? Can you prove that you are smarter than the compiler?

...

If you add such an index next week the code will not use it until you remove the USE-INDEX.

If you are using po-index because you want a certain ordering of records you should be using a BY clause.

Thank You very much Tom... The example was very "CLUMSY" as you can see... but you really solve that question...

Now... You tell the Compiler Selects the best INDEX isn´t it?

I have a question for you... Which is BEST PRACTICE...!!??

for each po
where po.whs-code = "10"
and po.cust-no >= 1000
and po.cust-no <= 9999
and po.dt-cancel = ? no-lock:
.... [PROCESS]...
end.

OR

for each po
where po.whs-code = "10"
and po.cust-no >= 1000
and po.cust-no <= 9999 no-lock:

if
po.dt-cancel <> ? then next.
.... [PROCESS]...
end.

OR

!!! Maybe you have a better idea !!!

Considering that po.dt-cancel isn´t part of any INDEX in the table.

In the first example how can affect the performance?

Thak you very much... I really appreciate your time!!! ;)

 
Top