-- 检查表的元数据是否有异常
-- 判断逻辑为如果表有记录,但table_rows为0则异常
select
t2.table_name
,t1.cnt
,t2.table_rows
,case when t1.cnt = 10 and t2.table_rows = 0 then 1 else 0 end as chk_rs
from (
select count(1) as cnt
from (
select id from db_name.table_name limit 10
) t11
) t1
left join (
select
table_name
,table_rows
from information_schema.tables
where table_schema='db_name'
and table_name = 'table_name'
) t2
on 1 = 1
;