sql - 如何估算Oracle索引的大小?

标签 sql oracle

我正在考虑将索引添加到Oracle表中,但是我想在索引建立后首先估算它的大小(我不需要精确的大小-只是一个估算值。)

假设我可以访问有关表的所有元数据(行数,列数,列数据类型等),那么我可以执行任何Oracle SQL查询来获取有关表当前状态的其他数据,并且知道我希望索引定义是什么时,如何估算此大小?

最佳答案

您可以使用这些Oracle Capacity planning and Sizing Spreadsheets

对于不太成熟的东西,如果您只想返回信封,请键入rough estimates for the index:

Calculate the average size of each of the columns that make up the index key and sum the columns plus one rowid and add 2 bytes for the index row header to get the average row size. Now add just a little to the pctfree value for the index to come up with an overhead factor, maybe 1.125 for pctfree of 10.

number of indexed table rows X avg row len X 1.125

Note - if the index contains nullable columns then every table row may not appear in the index. On a single column index where 90% of the columns are null only 10% would go into the index.

Compare estimate to tablespace extent allocation method and adjust final answer if necessary.

Also a larger overhead factor may be better as the index gets bigger since the more data indexed the more branch blocks necessary to support the index structure and the calculation really just figures for leaf blocks.

关于sql - 如何估算Oracle索引的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/827123/

相关文章:

mysql - 存储用户并传入单个表或单独的表

sql - 给定MSSQL查询的SQLite等效查询。

mysql - 销售期间的库存计算

sql - Oracle 计划中按本地索引进行分页时每个分区缺少 STOPKEY

sql - 如何在 count() 之后选择最大值 |甲骨文

oracle - Delphi - Oracle RowID 被 dbGO/ADO 忽略

c# - 如何从此查询中删除 sql 注入(inject)并使其正常运行?

MYSQL:如何自动删除表中依赖于另一个表中的记录的行

c# - C# linq 和 ORACLE 对点顺序的不同解释

oracle - ORA-03113 : end-of-file on communication channel with CAST MULTISET 的解决方法