8 messages in com.mysql.lists.mysqlRe: A question about the select count...
FromSent OnAttachments
Behrang Saeedzadeh27 Jun 2005 23:59 
Mathias28 Jun 2005 02:12 
Behrang Saeedzadeh28 Jun 2005 02:57 
Mathias28 Jun 2005 03:12 
SGr...@unimin.com28 Jun 2005 08:49 
Mathias28 Jun 2005 10:11 
SGr...@unimin.com28 Jun 2005 10:19 
Mathias28 Jun 2005 12:02 
Subject:Re: A question about the select count(*) performance and the InnoDB engine
From:Mathias (mfat@free.fr)
Date:06/28/2005 03:12:46 AM
List:com.mysql.lists.mysql

Selon Behrang Saeedzadeh <behr@gmail.com>:

Mathias,

Thanks a lot!

I will not explain the same thing for sqlserver, sybase ..., but when your RDBMs have a data dictionnary, you don't need to execute count(*) :o) WITH Updated statistics of course.

I'm a little bit confused here. Why the count(*) is not transformed to a select from the data dictionary if this way is faster? And what's the difference between updated statistics and statistics not updated?

With information_schema in 5.x and higher, innodb will act as it's done in all the other RDBMS.

Hope that helps

Sure! It helped by orders of magnitured more than I thought it can help ;-)

:o) Mathias

Using Opera's revolutionary e-mail client

Well, The information in data dictionnary are correct only just after updating them. imagine at 12h, you update statistics, num_rows=2000. At 12h05, you insert 1000 lignes and delete 500.

At 12h10, you ask the data dictinary num_rows, it will give you 2000, even if they are 2500.