Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select Count(*) performance
Message
 
À
04/08/2006 17:35:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01143102
Message ID:
01143350
Vues:
7
Hi Denis,

>Is it normal performace? May I get performance better?

Yes, it is. Count operations need to read all counted records from disk in order to count them. In your case, VFP reads all records from the current manufacturer.

There are only few exceptions for which VFP has optimized code. If you use SELECT COUNT(*) FROM...WHERE or COUNT TO...FOR... and the query is fully optimized, VFP only uses the index to count records. If you add any statement that requires post-processing (ORDER BY, GROUP BY) or return additional fields in the result set, VFP needs to read those information from the table itself.

You can increase performance a little bit if you keep the table sorted by manufacturer. If its content changes frequently, that's most likely not a approachable solution.

In most cases you should look out for alternative solutions. One could be to maintain a table with manufacturer, items and count. Create a trigger on the original table that updates the counter table. This way you have the results immediately available without having to change any part in your application that writes into the table.
--
Christof
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform