Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very Slow SQL , Why?
Message
 
À
31/07/1998 00:02:28
Rick Clarke
Fotobae Pty. Ltd.
Adelaide, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00122940
Message ID:
00122965
Vues:
13
>Hi Jim,
>
>It is nice to know that the select should respect the condition of the set key even though I can tell perhaps you prefered it did not.
>
>Why is it not doing so in my case, even at the command window where i can have better control proves me wrong on this one. e.g I sele maintable, set order to regions, then set key to "NORTH", BROW LAST and is quick as anything. When I the attempt to use a select * on the same table with the key set. I get the whole table in a result window of 120,000 rec's but the seting of the key to NORTH displays 23,000 records. What am I doing wrong?
>
>I have an index on UPPER(REGION).
>I have also used where region = "NORTH" and ... and ... etc...
>But it takes several minutes to query, should this be the case.(P200MMX 64RAM)
>I do not have an index on deleted() and set deleted is off.
>I am selecing into a temp table that has no indexes. I could build one each time the select statement is run. This is a bit slow, creating an index on or reindexing the temp table, don't you think? then theres the last performance hit when I finally brow the temptable.
>
>TIA Again!!!

When doing the select don't set any filters on indices. You should let your query match the index i.e. if your field is indexed on upper(region), you should have something like this:
m.region='north'
Select * from mytable where upper(region)=upper(m.region) order by somefield into cursor tmp. If that doesn't return a very rapid response, something else is wrong.
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform