Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>MyISAM is actually pretty fast with count(*) the downside is that the MyISAM storage is not that reliable and best avoided where data integrity is critical. </p> <p>InnoDB can be very slow to perform count(*) type queries, cause it is designed to allow for multiple concurrent views of the same data. So at any point in time, its not enough to go to the index to get the count. </p> <p>From: <a href="http://www.mail-archive.com/mysql@lists.mysql.com/msg120320.html" rel="noreferrer">http://www.mail-archive.com/mysql@lists.mysql.com/msg120320.html</a></p> <blockquote> <p>The database starts with 1000 records in it I start a transaction You start a transaction I delete 50 records You add 50 records I do a COUNT(<em>) and see 950 records. You do a COUNT(</em>) and see 1050 records. I commit my transaction - database now has 950 records to everyone but you. You commit your transaction - database has 1000 records again.</p> <p>How InnoDB keeps up with which records are "visible" or "modifiable" with respect to any transaction is through row-level locking, transaction isolation levels, and multi-versioning. <a href="http://dev.mysql.com/doc/refman/4.1/en/innodb-transaction-model.html" rel="noreferrer">http://dev.mysql.com/doc/refman/4.1/en/innodb-transaction-model.html</a> <a href="http://dev.mysql.com/doc/refman/4.1/en/innodb-multi-versioning.html" rel="noreferrer">http://dev.mysql.com/doc/refman/4.1/en/innodb-multi-versioning.html</a></p> <p>That is what makes counting how many records each person can see is not so straight-forward.</p> </blockquote> <p>So bottom line is you will need to look at caching the counts somehow as opposed to going to the table if you need to get at this information frequently and fast. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload