Mike Yearwood
Toronto, Ontario, Canada
Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
>hi everyone:
>
>quick question here - i'm using the cursor result of a query as the rowsource for a combobox. when is do:
>
>select lname, fname from table into cursor cursor1
>
>it is 10x (0.4 seconds vs 4 seconds) faster than:
>
>select alltrim(lname) + " " + alltrim(fname) from table into cursor cursor1
>or even:
>select alltrim(lname) from table into cursor cursor1
>
>the rowsource for the combobox is cursor1
There will be a slight difference because alltrim(lname) does more than just lname. I get 1.104 seconds on 500K records versus .786 seconds.
You should also add nofilter.
>
>i thought it had to do with optimization but there is no "where" clause in the select statement so rushmore shouldn't enter into it. even so, i indexed the table on "alltrim(lname)" and there was no change.
>
>if i'm concatenating (ie lname + fname), i need to do alltrim or the item will not fit in the combobox.
>
>am i doing anything wrong here? would it be better to select lname, fname into the cursor and then somehow take away the spaces when the cursor is made the rowsource? if so, how would i do that?
>
You should not be making indexes with variable size.
INDEX ON padr(ALLTRIM(lname)+IIF(not EMPTY(lname) AND NOT EMPTY(fname),",","")+ALLTRIM(fname),80) TAG SOMETAG
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement