Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unique Cursor
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00574322
Message ID:
00574327
Views:
20
Hi Chris,

In my experience a simple IIF() has no noticeable effect on query performance. Too many OR's could slow query down. The EMPTY() function you're using is not Rushmore optomizable. That's why I didn't use it in my SELECT. I prefer a simple select to the select with union but only tests can tell wich one is faster.
lcAssignedto = "Steven Dyke "
SELECT *, ;
     IIF( EMPTY(Assignedto), "2", "1") AS Sortorder ;
   FROM mytable ;
   WHERE Assignedto IN (lcAssignedto, SPACE( LEN(Assignedto) ) ;
   ORDER BY Sortorder ;
   INTO CURSOR mycursor
>Im just wondering Sergey, how much quicker is it to change your query to something like
>lcAssignedto = "Steven Dyke "
>SELECT *, "2" AS SortOrder ;
>   FROM mytable ;
>   <b>WHERE Assignedto = SPACE(LEN(Assignedto))</b> ;
>UNION ALL ;
>   SELECT *, "1" AS SortOrder ;
>   FROM mytable ;
>   <b>WHERE Assignedto = lcAssignedto</b> ;
>   ORDER BY Sortorder ;
>   INTO CURSOR mycursor
>
>Just from my experience I have Found IIF's and OR's to be rather slow in SQL.
>I dont know if this was just because of the data I was using at the time.
>
>Is there much of a performance hit to your knowledge?
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform