You can use the procedure dbms_space.create_index_cost to estimate how much space will take place. In the example below, the used_bytes is how much space is for the index data and the alloc_bytes is how much space is allocated within the tablespace.
SQL> set serverout on
SQL> exec dbms_stats.gather_table_stats('RODBA','EDBA_VMSTATS');
PL/SQL procedure successfully completed.
SQL> variable used_bytes number
SQL> variable alloc_bytes number
SQL> exec dbms_space.create_index_cost('create index RODBA.EDBA_VMSTAT_IX2 on RODBA.EDBA_VMSTATS(runqueue, blocked,cpu_user)',:used_bytes, :alloc_bytes);
PL/SQL procedure successfully completed.
SQL> print :used_bytes
USED_BYTES
----------
276723
SQL> print :alloc_bytes
ALLOC_BYTES
-----------
786432
No comments:
Post a Comment