ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【oracle 】如何估算即将创建的索引大小

【oracle 】如何估算即将创建的索引大小

原创 Linux操作系统 作者:杨奇龙 时间:2010-11-03 19:42:33 0 删除 编辑
SQL> startup
ORACLE 例程已经启动。
Total System Global Area  426852352 bytes                                      
Fixed Size                  1333648 bytes                                      
Variable Size             260048496 bytes                                      
Database Buffers          159383552 bytes                                      
Redo Buffers                6086656 bytes                                      
数据库装载完毕。
数据库已经打开。
SQL> drop table t;
表已删除。
SQL> create table t as select object_id id ,object_name from dba_objects;
表已创建。
SQL> set serveroutput on
SQL> declare
  2  l_index_ddl varchar2(1000);
  3  l_used_bytes number;
  4  l_allocated_bytes number;
  5  begin
  6  dbms_space.create_index_cost (
  7  ddl =>'create index idx_t on t(id) ', --执行的ddl
  8  used_bytes => l_used_bytes,
  9  alloc_bytes => l_allocated_bytes );
 10  dbms_output.put_line ('used= ' || l_used_bytes || 'bytes'
 11  || '  allocated= ' || l_allocated_bytes || 'bytes');
 12  end;
 13  /
used= 345098bytes  allocated= 720896bytes                                      
PL/SQL 过程已成功完成。
说明:  used_bytes  给出索引数据实际表现的字节数。
         allocated 是当实际创建索引时在表空间中实际占用的字节数。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22664653/viewspace-677328/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
MySQL DBA NoSQL DEVOPS

注册时间:2009-10-07

  • 博文量
    1026
  • 访问量
    8206042