1. 环境: 表记录900w条;
2. 使用:count(*), count(rowid), count(主键) 都需要30多秒
3. 使用语句查看FSFI:
select tablespace_name,sqrt(max(blocks)/sum(blocks))* (100/sqrt(sqrt(count(blocks)))) FSFI
from dba_free_space
group by tablespace_name order by 1;
本文探讨了在拥有900万条记录的表中使用SQL进行不同类型的计数操作(如count(*)等)的性能表现,并给出了一个用于评估表空间自由空间碎片指数(FSFI)的查询示例。
1. 环境: 表记录900w条;
2. 使用:count(*), count(rowid), count(主键) 都需要30多秒
3. 使用语句查看FSFI:
select tablespace_name,sqrt(max(blocks)/sum(blocks))* (100/sqrt(sqrt(count(blocks)))) FSFI
from dba_free_space
group by tablespace_name order by 1;
8597
578

被折叠的 条评论
为什么被折叠?