Hello, please sign in or register
You are here: Home

COUNT number of rows in Innodb

Count the number of records is not a stored value in MySQL's Innodb database engine. To calculate it e.g. SELECT COUNT(*) FROM innodb_table results in a full table scan. Therefore is rather slow. Here are some alternatives to the above query.

SHOW TABLE STATUS FROM  db_log LIKE 'innodb_table'

In this example we can look at either columns that are returned, "Rows" will vary greatly as its just a random guess which is usually accurate to within 10%. Or the column "Auto_increment" which is great if you have an auto increment key, and dont often delete records. This would be my prefered choice.

EXPLAIN SELECT (*) FROM `innodb_table`

Return the result of the column "rows". Like the above estimate its accurate to within 10%

Comments

guoyanying
But the replica watches sentry reebok shoes knew abercrombie and fitch uk his
Created 07/10/15
1015maoqiuyun
coach outlet online, http://www.coachoutletonline-store.us.com/
Created 15/10/15
clibin
Tyrion 5c cases watched her ray ban sunglasses read. His timber...
Created 18/04/16
chenyan
Bond grinned. pandora-bracciali.it "We bcbgmax.in.net only chaussure...
Created 15/06/16
chenyan
Bond grinned. pandora-bracciali.it "We bcbgmax.in.net only chaussure...
Created 15/06/16
cc
discount oakley sunglasses retro jordans
Created 26/10/16
michael kors factory outlet
adidas nmd pandora bracelet
Created 16/05/17
wanglili
true religion outlet ralph lauren outlet michael kors...
Created 21/08/17
meadc
Oakley Sunglasses hermes belt
Created 09/09/17
Title*
Comment

Prove you are not a robot

To prove you are not a robot, please type in the six character code you see in the picture below
Security confirmation codeI can't see this!
Contact
Name*
Email never shown*
Home Page

Author

Andrew Dodson
Since:Feb 2007

Comment | flag

Categories

Bookmark and Share