Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Count(*) performance
Message
 
To
04/08/2006 17:35:11
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01143102
Message ID:
01143350
Views:
9
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
Previous
Reply
Map
View

Click here to load this message in the networking platform