Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number of rows in a table keeps changing every time I SELECT, can anyone shed light?

I did a import of a bunch of data, and the expected number of rows should have been 41856.

Now every time I go into the table using phpMyAdmin, I see a different amount of rows. There is nothing connecting to it which would change the number of rows.

Here I added a few screen shots of the table, a few seconds apart from each other.

41,610 records, 41,759 records, 41,647 records...

enter image description hereenter image description hereenter image description here

like image 566
Gershon Herczeg Avatar asked Aug 17 '12 13:08

Gershon Herczeg


1 Answers

Some storage engines, such as MyISAM and ISAM, store the exact count. BUT for other storage engines, such as InnoDB, this value is an approximation, and may vary from the actual value by as much as 40 to 50%. In such cases, use SELECT COUNT(*) to obtain an accurate count."

like image 137
compcobalt Avatar answered Sep 28 '22 15:09

compcobalt