select 
  sum(table_rows  )
from information_schema.partitions  where 
  table_schema = schema()  
  and table_name='test';
 和 我直接 select count(*) from test;两个的表的记录不一致啊。  查错了吗?还有是  有的分区里面的数据 跟我直接带条件进行查询也不一致。  为什么?

解决方案 »

  1.   

    information_schema.partitions表里是大概的数据量
    就和tables里面的数据一样,innodb引擎的是不精确的
      

  2.   

    information_schema.partitions里的数据并不是实时更新。
      

  3.   


    information_schema里的数据不精确。
      

  4.   

    不能直接取information_schema.partitions中的数据,从表中取数据
      

  5.   

    information_schema中的数据仅供参考,并不是精确的数据,这个记录数主要是用于初步的分析。