Perl-Sensitive Sunglasses | |
PerlMonks |
Re: prepare statement within DBIby CountZero (Bishop) |
on Aug 25, 2004 at 19:43 UTC ( [id://385793]=note: print w/replies, xml ) | Need Help?? |
There is only one way to find out: try both approaches and time x runs and see what is best. COUNT(*) should be highly optimized on the database server side, probably not even needing to run through the whole of the datatable, so it could indeed be that most of the time is spent in connecting to the DB and preparing the query. On a MySQL database with about 70,000 records, COUNT(*) took 1/10 of a second to come back with the result. The database was on the local machine, so transmission time was neglible. Querying a table with only 27 records, took 0.10 seconds as well. Probably 0.10 of second is the minimum time to run a query. CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In Section
Seekers of Perl Wisdom
|
|