Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Re: Re: How to count rows using DBI & mysql - Performance results

by elwarren (Curate)
on Jun 11, 2001 at 22:45 UTC ( #87616=note: print w/replies, xml ) Need Help??


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.
  • Comment on Re: Re: Re: Re: How to count rows using DBI & mysql - Performance results

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87616]
help
Chatterbox?
[Eily]: s/complete ness/complete mess/ :P
[Eily]: and you can overload "0+" rather than bool, as numification is used instead of stringification in boolean context when available

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2017-07-27 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (415 votes). Check out past polls.