📜 ⬆️ ⬇️

An interesting feature of InnoDB type tables

Just encountered an interesting feature of InnoDB type tables: calling the query SHOW TABLE SATUS; shows inaccurate number of rows in the table, and the more rows, the greater the error. Details under the cut.

For example, in a table with a size of 28.5 MB and a number of rows of 390,000, it showed values ​​in the range from 190,000 to 509,000.

After rustling in the manual found clarification:
The number of rows. Some storage engines, such as MyISAM, store the exact count. For other storage engines such as 40% to 50%. In such cases, use SELECT COUNT (*) to obtain an accurate count.

The peculiarity is unusual and, as for me, a bit strange, but this is not a bug.
')
Can someone explain why?

PS Please do not minus much, this is my first .com

upd: I have zero experience in writing articles, therefore objective criticism is accepted, incl. and to the "rows".

Source: https://habr.com/ru/post/80578/


All Articles