Why is innodb's SHOW TABLE STATUS so unreliable?

前端 未结 2 1242
萌比男神i
萌比男神i 2020-12-15 07:43

I know that you shouldn\'t rely on the values returned by InnoDB\'s SHOW TABLE STATUS. In particular, the row count and avg data length.

But I thought maybe it was a

2条回答
  •  渐次进展
    2020-12-15 08:24

    The reasons for not keeping accurate statistics, including the row count in the table, is the multiversioning of rows InnoDB utilizes to provide transactions. What is the actual count of rows actually depends on isolation level of the transactions (as not-commited transaction may have deleted or inserted records), and different transactions can run in different isolation levels, which means that the question 'how many records there are' may be answered correctly only if there are no transactions running. So keeping a counter of the rows or data length is nearly impossible.

    Read more about InnoDB restrictions

提交回复
热议问题