获取表的行数(非精确,速度快)
select c.* , b.* FROM pg_class as c, pg_namespace as b
where c.relnamespace=b.oid and b.nspname ='sde' and c.relname='a'
select c.reltuples FROM pg_class as c, pg_namespace as b
where c.relnamespace=b.oid and b.nspname ='sde' and c.relname='a'
4.517069e+06
获取某个表的 tuples
SELECT pg_stat_get_live_tuples('public.TableName'::regclass::oid);
更新统计信息
VACUUM (ANALYZE ) TableName
VACUUM ANALYZE TableName
VACUUM FREEZE public.TableName;