在我的表中,我有两个名为“ a”和“ b”的不可为空的列,它们具有相似的数据类型(=数字)和相等的行数。
此表中的“ a”列上当前有一个索引,其大小为60G。
我想在“ b”列上创建一个新索引,并想要估计需要多少空间。
为此,我想估计当前现有索引的大小,以检查下面的“解释计划”估计是否正确。但是正如您看到的那样,这种估计是错误的,我无法相信它会在列“ b”上创建新索引。
知道为什么估计错误吗?
explain plan for create index sample_index on my_table(column_a);
select * from table(dbms_xplan.display);
Plan hash value: 3327945602
------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
------------------------------------------------------------------------------------------------------
| 0 | CREATE INDEX STATEMENT | | 1209M| 4612M| 11M (1)| 39:43:40 | | |
| 1 | INDEX BUILD NON UNIQUE|sample_index | | | | | | |
| 2 | SORT CREATE INDEX | | 1209M| 4612M| | | | |
| 3 | PARTITION LIST ALL | | 1209M| 4612M| 11M (1)| 37:41:16 | 1 | 370 |
| 4 | TABLE ACCESS FULL | my_table | 1209M| 4612M| 11M (1)| 37:41:16 | 1 | 370 |
------------------------------------------------------------------------------------------------------
Note
-----
- estimated index size: 28G bytes