All,

a fast COUNT(*) is in the TODO of InnoDB. But it is relatively difficult to implement without reducing INSERT performance.

Regards,

Heikki
Oracle/Innobase

----- Original Message ----- From: "Jigal van Hemert" <[EMAIL PROTECTED]>
Newsgroups: mailing.database.myodbc
Sent: Wednesday, November 02, 2005 10:30 AM
Subject: Re: Will SELECT COUNT(*) FROM TABLE ever be cheap on INNODB?


Shankar Unni wrote:
[EMAIL PROTECTED] wrote:

If I understand the InnoDB engine correctly, I don't see how they
could speed it up unless they start tracking how many records belong
to each active "version" within a database.


But one thing you can do to speed it up somewhat is to do a
COUNT(PK_column) (rather than COUNT(*)) if you have a column that is a
primary key for the table - that's the same thing semantically, and
involves searching an index rather than the data records themselves,
which should involve less I/O.

If I understand
http://dev.mysql.com/doc/refman/5.0/en/table-and-index.html
correctly, the index of the primary key is stored as the clustered index
together with the data. To me this means that there is no difference
between counting the primary key entries and counting the data entries.

Regards, Jigal.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to