免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1559 | 回复: 1
打印 上一主题 下一主题

[Veritas NBU] (原创)在数据仓库中创建索引 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-03-16 14:31 |只看该作者 |倒序浏览
(原创)在数据仓库中创建索引











创建索引很简单,但如果给一个超过1TB表创建索引呢? 你的临时空间够用吗? There is a helpful tip share to us: How to estimate the exact temp space usage during the index creation on a huge table ? 这里有一个有用的技巧share给大家:如果精确计算创建索引所需的最大临时空间。 算法是: The algorithm is : ( ColumnA length + ColumnB length + .. + Rowid length ) * row_number For example : create index DW.ixd_1 on DW.tableA (ColumnA ,ColumnB); 1) 在统计信息中检查字段的平均长度(in case your stats is not too stale)希望你的统计不要太陈旧。 SELECT COLUMN_NAME, DATA_TYPE, AVG_COL_LEN FROM DBA_TAB_COLUMNS WHERE TABLE_NAME = '' AND OWNER = '' AND COLUMN_NAME IN ('ColumnA ', 'ColumnB') COLUMN_NAME, DATA_TYPE, AVG_COL_LEN ____________ _________ ___________ ColumnA vachar2 10 ColumnB number 7 2) 检查row_number SELECT num_rows FROM DBA_TABLES A WHERE TABLE_NAME=('TABLEA'); NUM_ROWS ---------- 100,000,000 3) 检查当前 database version下的rowid的长度 SELECT lengthb(ROWID) FROM dual ; --10g ______________ 18 4) 计算 .. (10 +7 +1 Byte *1,000,000 = 3337.86Mb 5) If you have the stale table statistics, you also can estimate this by table defining, but it will be the MAX size. A couple weeks ago, I created an index on a FACT table with 3,804,025,560 records, finally it consumed 190Gb tempspace (v$sort_usage). It did give me a surprise ;-O , I had to borrow space from other where .. So when you will create an index in a dataware house, I hope it won't give you surprise on temp space usage. 几周以前,我在一个拥有38亿记录的表创建了一个索引,通过观察temp space的usage,它最大消耗了190GB的tempspace。 为了成功创建它,我不得不从其它地方借了些空间来扩张我的temp space。 希望你以后,在创建怪物级索引的时候,遇到temp space error,don‘t be too surprise

论坛徽章:
0
2 [报告]
发表于 2012-03-16 14:33 |只看该作者
谢谢分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP