Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Performance issues when querying shared data
Message
De
07/10/2005 13:51:16
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
07/10/2005 11:04:06
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 6
Divers
Thread ID:
01057091
Message ID:
01057282
Vues:
10
Hi Jay

I think you and Thomas have it backward. He's saying that putting field1="" is a performance trick. I interpret that to mean that having an optimizable where clause that pulls all records is faster than having no where clause at all.

I have a million record table just sitting around. There is an integer field spd_id with numbers ranging from 1 to 1,000,000. I ran the following...

SET EXCLUSIVE OFF
CLEAR ALL
FLUSH
M.A=SECONDS()
SELECT * from t:\speed INTO CURSOR TEMP NOFILTER
?SECONDS()-M.A
*61.268

CLEAR ALL
FLUSH
M.A=SECONDS()
SELECT * from t:\speed WHERE spd_id between 1 AND 1000000 INTO CURSOR TEMP NOFILTER
?SECONDS()-M.A
*56.731

CLEAR ALL
FLUSH
M.A=SECONDS()
SELECT * from t:\speed INTO CURSOR TEMP NOFILTER
?SECONDS()-M.A
*64.002

CLEAR ALL
FLUSH
M.A=SECONDS()
SELECT * from t:\speed WHERE .T. INTO CURSOR TEMP NOFILTER
?SECONDS()-M.A
*66.646

If caching were the cause, I'd expect the second and subsequent queries to take similar times. Set deleted is on and there is no index on deleted(). VFP8 SP1.

>Ahhhh, is that all he wants? I use "WHERE .F." to get an empty cursor/table.
>
>>Mathias;
>>
>>If all you need is a blank table then I like to use SELECT * FROM MyTable WHERE 1>2. This avoids picking up a blank record. :)
>>
>>I would suggest trying this on your local machine. You have to know how much degradation is due to your network. Firewalls and antivirus programs can slow things down, on local machines as well as servers.
>>
>>What network are you using?
>>
>>Tom
>>
>>
>>>Well,
>>>
>>>The initial query is:
>>>
>>>Select a.field1 As Code, a.Field2 As Desc From TableA a Into Cursor tmpCursor
>>>
>>>The table has an index on field1 so I added:
>>>
>>>where a.Field1 = ""
>>>
>>>It's a cheat I know but the query is optimised and works as long as set exact off.
>>>
>>>The time jumps from 5 secs to under 2.
>>>
>>>Regards
>>>>>Hi Mike,
>>>>>
>>>>>Yes I can and I have by introducing a dummy where clause. It optimises and halves the time roughly 2 seconds.
>>>>>
>>>>
>>>>Hi Mathias,
>>>>
>>>>Can you expand a little on this "dummy where clause" idea?
>>>>
>>>>Regards,
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform