Query With Inequality In Index Using Progress

Status
Not open for further replies.
Z

zarose

Guest
What is the fastest way to query for records using an inequality in Progress 4GL? For example, if I need to find all the records whose state field doesn't match 'MI', how would I write that for best performance and why?

Various solutions I have been told include using a broader or different index and then using an IF statement, to avoid any use of inequality, such as:

FOR EACH record NO-LOCK:
IF record.state = "MI" THEN NEXT.
/*do stuff*/
END.


I've been told to avoid using NE statements, as they kill performance,

FOR EACH record NO-LOCK
WHERE record.state NE "MI":
/*do stuff slowly, apparently*/
END.


but I've also been told using OR is evil as well.

FOR EACH record NO-LOCK
WHERE record.state = "WI" OR "AL":
/*didn't write all 49 minus MI for space*/
END.


I've not been given substantive evidence for why any of these three would be superior, and there isn't sufficient data in my development environment to test with the actual situation I'm working on.

Continue reading...
 
Status
Not open for further replies.
Top