in reply to Re: Re: Re: How to count rows using DBI & mysql - Performance results
in thread How to count rows using DBI & mysql - Performance results
Good point. I'm not sure how intelligent MySQL is, but the
optimizer in Oracle will make this choice.
If you submit a
count(*) query on a table with a primary key, it will use
the index to generate the count instead of actually counting
all the rows in the table.
The same holds true when doing a count(colname) and an
index exists on that column.