- Dathan Vance Pattishall
  - Sr. Programmer and mySQL DBA for FriendFinder Inc.
  - http://friendfinder.com/go/p40688


-->-----Original Message-----
-->From: Hsiu-Hui Tseng [mailto:[EMAIL PROTECTED]
-->Sent: Thursday, November 06, 2003 3:41 PM
-->To: [EMAIL PROTECTED]
-->Subject: select count(*) / select count(column) in innodb
-->
-->Hi,
-->
-->select count(*) is very slow in innodb (because it is a table scan).
Is
-->there any difference if I change it to select count(column).
-->
-->I did some test and some times select count(*) is really slow and
some
-->time
-->select count(column) is slow. Could anyone help me?

INNODB is slow because it’s a row level locking schema and the nature of
transactions (e.g. what committed what's not etc). Heikki Tuuri will
give a much more solid explanation then I could. At the conference he
did give a prelude that this functionality taken for granted will
improve in later versions of innodb. In the interim you can use 

Show table status like '<YOUR TABLE NAME%>';

But it's not very accurate with INNODB.


-->
-->If I need do a select(*) in innodb, is there any way to get away from
the
-->slowness?

No, use MYISAM;


-->
-->In the sql, should we avoid doing select * or select count(*)? What
is
-->the
-->reason?

Well why transfer unneeded column values over your network? It makes a
difference when these columns are big blobs / texts and the intention is
not to do so.

-->
-->Thank you for your help!
-->
-->Hsiu-Hui
-->
-->
-->--
-->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