[quote=引用 12 楼 ZJHZ_叶的回复:]analyze table 表名 compute statistics; --这条语句是单个表的 你可以利用sql语句批量生成语句,然后执行 批量生成语句:select 'analyze table '||table_Name||' compute statistics;'from user_TABLES 这样每张表都会重新统计,都是最新的行数
analyze table 表名 compute statistics; --这条语句是单个表的 你可以利用sql语句批量生成语句,然后执行 批量生成语句:select 'analyze table '||table_Name||' compute statistics;'from user_TABLES 这样每张表都会重新统计,都是最新的行数
说明那张表的统计信息不是最新的
[quote=引用 15 楼 ZJHZ_叶 的回复:] (1)执行 select 'analyze table '||table_Name||' compute statistics;'from user_TABLES (2)执行(1)步骤生成的语句 (3)select sum(num_rows) from user_tables
(1)执行 select 'analyze table '||table_Name||' compute statistics;'from user_TABLES (2)执行(1)步骤生成的语句 (3)select sum(num_rows) from user_tables
SELECT COUNT(1) FROM user_tables t WHERE t.NUM_ROWS IS NOT null ORDER BY t.NUM_ROWS DESC;
嗯,基本这样, 注意 last_analyzed这个时间,这个表示统计的时间,有可能统计的时候表中没数据,现在表中有数据, 可以analyze table tablename compute statistics; 批量生成语句:select 'analyze table '||table_Name||' compute statistics;'from user_TABLES 表数据多的话,也是要一些时间的
user_tables select a.table_name,a.column_name,a.segment_name,b.tablespace_name, b.bytes from user_lobs a, user_segments b where a.segment_name=b.segment_name
17,377
社区成员
95,128
社区内容
加载中
试试用AI创作助手写篇文章吧