Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unique Cursor
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00574322
Message ID:
00574327
Vues:
21
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform