- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果重建表索引会释放超过 2GB 的表空间,我只想重建表索引。如何确定通过重建索引将释放的表空间量?
最佳答案
您可以使用DBMS_SPACE.CREATE_INDEX_COST估计已使用的空间量重建索引后。从 DBA_SEGMENTS.BYTES 中减去该值即可估算出节省的空间。
下面的示例显示 DBMS_SPACE 对重建异常糟糕的索引所节省的空间做出了相当准确的预测。套餐需要收集统计数据,因此您可能需要阅读有关从 this 收集统计数据所导致的潜在问题的信息。稍微相关的答案。
首先,创建一个表和示例数据,并收集统计数据。
drop table test1 purge;
create table test1(a number, b number, c number);
insert /*+ append */ into test1 select level, level, level
from dual connect by level <= 500000;
commit;
begin
dbms_stats.gather_table_stats(user, 'TEST1');
end;
/
这表明 DBMS_SPACE 对新索引的成本进行了准确的预测。
declare
v_used_bytes number;
v_alloc_bytes number;
begin
dbms_space.create_index_cost(
ddl => 'create index test1_idx on test1(a, b, c)'
,used_bytes => v_used_bytes
,alloc_bytes => v_alloc_bytes
);
dbms_output.put_line('Esimated Bytes: '||
trim(to_char(v_alloc_bytes,'999,999,999')));
end;
/
Esimated Bytes: 14,680,064
create index test1_idx on test1(a, b, c);
select trim(to_char(bytes, '999,999,999')) actual_bytes
from dba_segments where segment_name = 'TEST1_IDX';
ACTUAL_BYTES
------------
15,728,640
现在模拟一个“坏”索引。一个常见的误解是索引不会自动重新使用空间。真正的问题是,在删除每个条目之前,索引不会重新声明叶 block 的空间。此示例删除 95% 的行,但空间量相同。
delete from test1 where mod(a, 20) <> 1;
commit;
select trim(to_char(bytes, '999,999,999')) actual_bytes
from dba_segments where segment_name = 'TEST1_IDX';
ACTUAL_BYTES
------------
15,728,640
重新收集统计数据,现在估计值与重建后的实际大小非常相似。
begin
dbms_stats.gather_table_stats(user, 'TEST1');
end;
/
declare
v_used_bytes number;
v_alloc_bytes number;
begin
dbms_space.create_index_cost(
ddl => 'create index test1_idx on test1(a, b, c)'
,used_bytes => v_used_bytes
,alloc_bytes => v_alloc_bytes
);
dbms_output.put_line('Esimated Bytes: '||
trim(to_char(v_alloc_bytes,'999,999,999')));
end;
/
Esimated Bytes: 720,896
alter index test1_idx rebuild;
select trim(to_char(bytes, '999,999,999')) actual_bytes
from dba_segments where segment_name = 'TEST1_IDX';
ACTUAL_BYTES
------------
851,968
关于oracle - 如何判断通过重建索引将释放的表空间量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17679033/
判断置顶文章 is_sticky() 函数用来判断一篇文章是否为置顶文章。 用法 ?
判断结构要求程序员指定一个或多个要评估或测试的条件,以及条件为真时要执行的语句(必需的)和条件为假时要执行的语句(可选的)。 下面是大多数编程语言中典型的判断结构的一般形式: 判断语句 C
我经常这样写: (if (nil? a-value) another-value a-value) 是否有更简单的功能可用,例如: (if-nil? a-value another-value) 最佳
MySQL IF 语句允许您根据表达式的某个条件或值结果来执行一组 SQL 语句。 要在 MySQL 中形成一个表达式,可以结合文字,变量,运算符,甚至函数来组合。表达式可以返回 TRUE,FA
也就是说,是否有一种工具可以自动显示给定语法的完整语言,包括突出歧义(如果有)? 最佳答案 BNF 风格的文法可能有一些特殊性,但总的来说,确定给定的上下文无关文法(例如 BNF)是否有歧义是不可能的
有没有办法确定像下面这样的 Axios 请求是否收到了答案并完成了? axios.get('/api') .then(response => this.data = response.data); 最
我想请大家禁用 Firebug 。如何确定自己安装了firebug?所以它是一个跨浏览器,并在 Chrome、Mozilla 和 IE8 + 中确定 最佳答案 两步: 如果 window.consol
我有一个看起来像这样的对象: var searchFilter = {_id: XXX, approved: true} 用于驱动 Meteor 集合搜索过滤器。然后,我有一对文本框,允许用户输入一系
我正在循环并向我的数据库中插入几百万条记录。性能是第一要务。 我想利用无状态 session ,但您可能知道它们不支持在更复杂的实体上级联对象。 是否有一种通用方法可以确定实体是否具有级联记录?如果是
我正在使用 pdfminer 解析一些 PDF 文件。图书馆。 我需要知道文档是否是扫描文档,扫描机将扫描图像放在顶部,将 OCR 提取的文本放在背景中。 有没有办法识别文本是否可见,因为 OCR 机
我正在寻找一种方法来找出当前为浏览器游戏 TribalWars 编写的脚本打开的页面。 URL 的设置非常相似,对于知道自己在做什么的人来说这应该很容易(我显然不知道)。 URL 如下所示: http
我在 C# 中使用包装的 C 库,需要将图像从该库转换为位图并返回,但没有复制像素缓冲区。 转换为位图很简单: Bitmap WrapAsBitmap(CImage image) { retu
有没有办法检查调用方法的Controller是否来自Area内的Controller? 例如,我有一个继承自 AuthorizeAttribute 的类,例如 public class CustomA
是否可以找到MySQL View 中某列所属的表名? 如果 View 构造为 CREATE VIEW alpha_view AS SELECT alpha.col1, alpha.col2,
如何判断 .Net 应用程序是作为桌面应用程序运行还是作为服务运行? 我们正在尝试使用 Fitnesse 测试我们的应用程序,它将应用程序作为服务加载,然后调用它。但是当一个模式错误框被按下时,它就会
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度理解。包括尝试过的解决方案、为什么它们不起作用,以及
我试图计算出 iframe 内容的大小,以便调整 iframe 元素的大小以包含其内容。 如何确定 iFrame 是否已加载以及我是否可以可靠地测量它的内容尺寸。 注意:onload 事件不会执行,因
这个问题在这里已经有了答案: How to write portable code in c++? (12 个答案) 关闭 9 年前。 我正在尝试编写可以用任何现代版本的 g++ 编译的代码,但遇到
这个问题在这里已经有了答案: distinguish shared objects from position independent executables (2 个答案) 关闭 4 年前。 我有
我的目标是如果 dte 与当前时间相差不到 1 小时,则停止循环。是否有“ ruby 方式”来做到这一点? #THIS IS AN INFINITE LOOP, DONT RUN THIS dte=D
我是一名优秀的程序员,十分优秀!