楼主: kelsoncong

[精华] 数据库调优的三板斧[已结贴]

[复制链接]
论坛徽章:
314
行业板块每日发贴之星
日期:2012-07-12 18:47:29双黄蛋
日期:2011-08-12 17:31:04咸鸭蛋
日期:2011-08-18 15:13:51迷宫蛋
日期:2011-08-18 16:58:25紫蛋头
日期:2011-08-31 10:57:28ITPUB十周年纪念徽章
日期:2011-09-27 16:30:47蜘蛛蛋
日期:2011-10-20 15:51:25迷宫蛋
日期:2011-10-29 11:12:59ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41鲜花蛋
日期:2011-11-09 20:33:30
121#
发表于 2012-6-27 10:52 | 只看该作者
kelsoncong 发表于 2012-6-27 10:38
这个我之前看过点介绍,是不一样的,
另外我在itpub上看到一篇博文写的很不错,
http://blog.itpub.net ...

和我的想法不一样:

OLTP 用于日常的dml, BASIC 用于大规模的数据加载,或者MOVE 操作。
我没想过在BASIC 下,INSERT 也能压缩。

问:11G的BASIC 压缩,和10G 的压缩是否一样? 我印象中,10G的是BASIC 压缩,
对普通的DML 操作无效。

使用道具 举报

回复
论坛徽章:
67
现任管理团队成员
日期:2012-06-02 02:10:00ITPUB元老
日期:2012-09-12 14:06:14ITPUB社区千里马徽章
日期:2013-06-09 10:15:34季节之章:冬
日期:2012-09-04 11:05:30季节之章:春
日期:2012-09-05 09:20:36优秀写手
日期:2013-12-18 09:29:09马上有房
日期:2014-04-10 13:35:362014年新春福章
日期:2014-04-14 09:54:08马上有车
日期:2014-02-28 16:43:13马上加薪
日期:2014-02-19 11:55:14
122#
 楼主| 发表于 2012-6-27 10:54 | 只看该作者
anlinew 发表于 2012-6-27 10:51
博文里的错误估计也是没考虑pctfree:

Anlinew V5, 我之前不知道有这个区别,学习了,
不能成天混pub了, 还得赶紧回去翻翻书学习去

使用道具 举报

回复
招聘 : Java研发
论坛徽章:
71
马上加薪
日期:2014-02-19 11:55:14蜘蛛蛋
日期:2012-12-26 18:16:01茶鸡蛋
日期:2012-11-16 08:12:48ITPUB 11周年纪念徽章
日期:2012-10-09 18:05:07奥运会纪念徽章:网球
日期:2012-08-23 14:58:08奥运会纪念徽章:沙滩排球
日期:2012-07-19 17:28:14版主2段
日期:2012-07-07 02:21:02咸鸭蛋
日期:2012-03-23 18:17:482012新春纪念徽章
日期:2012-02-13 15:13:512012新春纪念徽章
日期:2012-02-13 15:13:51
123#
发表于 2012-6-27 10:57 | 只看该作者
ZALBB 发表于 2012-6-27 10:52
和我的想法不一样:

OLTP 用于日常的dml, BASIC 用于大规模的数据加载,或者MOVE 操作。

你是对的
OLTP中的日常DML也能压缩的新特性,原理应该还是先以非压缩方式保存,当达到一定阀值后才真正压缩放到压缩块里

OLTP compression differs from basic compression found in prior versions as it allows compression during DML operations and not just during direct path loads. When a table is set to use OLTP compression and rows are inserted into a new block in that table they are inserted uncompressed, just as with a non-compressed table. When enough inserts cause that block to be considered full then it is customarily not available for further inserts. At this time compression is attempted on the block. If the compression gains sufficient free space then the compression is retained and the block is still a candidate for further insertions. If the compression fails to gain sufficient free space then that compression attempt is discarded and the block is considered full.

使用道具 举报

回复
论坛徽章:
67
现任管理团队成员
日期:2012-06-02 02:10:00ITPUB元老
日期:2012-09-12 14:06:14ITPUB社区千里马徽章
日期:2013-06-09 10:15:34季节之章:冬
日期:2012-09-04 11:05:30季节之章:春
日期:2012-09-05 09:20:36优秀写手
日期:2013-12-18 09:29:09马上有房
日期:2014-04-10 13:35:362014年新春福章
日期:2014-04-14 09:54:08马上有车
日期:2014-02-28 16:43:13马上加薪
日期:2014-02-19 11:55:14
124#
 楼主| 发表于 2012-6-27 10:58 | 只看该作者
ZALBB 发表于 2012-6-27 10:52
和我的想法不一样:

OLTP 用于日常的dml, BASIC 用于大规模的数据加载,或者MOVE 操作。

按照Oracle自己的描述应该是不一样的,11g比10g的压缩不仅仅是做了些调整,很多功能都是新增的。

下面是Oracle的原文的描述:

It is important to mention that table compression enhancements introduced in Oracle Database 11g are not just incremental changes. An enormous amount of work has gone into making sure that the new compression technology has negligible impact on updates because any noticeable write-time penalty due to compression will not be acceptable in an OLTP environment. As a result, compression technology in Oracle Database 11g is very efficient and could reduce the space consumption by 50–75%. And while you do that, not only your write performance does not degrade, but also your read performance or queries improve. This is because unlike desktop-based compression techniques where you have to wait for data to be uncompressed, Oracle technology reads the compressed data (less fetches needed) directly and does not require any uncompress operation.

使用道具 举报

回复
论坛徽章:
3
ITPUB 11周年纪念徽章
日期:2012-10-09 18:14:482013年新春福章
日期:2013-02-25 14:51:24射手座
日期:2015-12-17 12:42:07
125#
发表于 2012-6-27 11:07 | 只看该作者
kelsoncong 发表于 2012-6-27 10:21
第一板斧里面有介绍,我改成了
Alter table ta truncate partition wk_xxx;
insert into ta select * f ...

感觉这个采用分区交换应该能行啊

使用道具 举报

回复
论坛徽章:
67
现任管理团队成员
日期:2012-06-02 02:10:00ITPUB元老
日期:2012-09-12 14:06:14ITPUB社区千里马徽章
日期:2013-06-09 10:15:34季节之章:冬
日期:2012-09-04 11:05:30季节之章:春
日期:2012-09-05 09:20:36优秀写手
日期:2013-12-18 09:29:09马上有房
日期:2014-04-10 13:35:362014年新春福章
日期:2014-04-14 09:54:08马上有车
日期:2014-02-28 16:43:13马上加薪
日期:2014-02-19 11:55:14
126#
 楼主| 发表于 2012-6-27 11:12 | 只看该作者
yangb71881 发表于 2012-6-27 11:07
感觉这个采用分区交换应该能行啊

这个insert into 语句是为了描述方便,被我简化了的,实际抽取的时候还是有些条件和限制的,表的结构什么的也不完全一样,否则也不需要做抽取,直接用原表就行了

使用道具 举报

回复
论坛徽章:
314
行业板块每日发贴之星
日期:2012-07-12 18:47:29双黄蛋
日期:2011-08-12 17:31:04咸鸭蛋
日期:2011-08-18 15:13:51迷宫蛋
日期:2011-08-18 16:58:25紫蛋头
日期:2011-08-31 10:57:28ITPUB十周年纪念徽章
日期:2011-09-27 16:30:47蜘蛛蛋
日期:2011-10-20 15:51:25迷宫蛋
日期:2011-10-29 11:12:59ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41鲜花蛋
日期:2011-11-09 20:33:30
127#
发表于 2012-6-27 11:23 | 只看该作者
kelsoncong 发表于 2012-6-27 10:58
按照Oracle自己的描述应该是不一样的,11g比10g的压缩不仅仅是做了些调整,很多功能都是新增的。

下面 ...

据我的了解,10G版本只有BASIC 压缩,没有OLTP 压缩,我想知道,10G 的BASIC 压缩到了 11G 后,
会有哪些改进,不包括OLTP。

使用道具 举报

回复
论坛徽章:
67
现任管理团队成员
日期:2012-06-02 02:10:00ITPUB元老
日期:2012-09-12 14:06:14ITPUB社区千里马徽章
日期:2013-06-09 10:15:34季节之章:冬
日期:2012-09-04 11:05:30季节之章:春
日期:2012-09-05 09:20:36优秀写手
日期:2013-12-18 09:29:09马上有房
日期:2014-04-10 13:35:362014年新春福章
日期:2014-04-14 09:54:08马上有车
日期:2014-02-28 16:43:13马上加薪
日期:2014-02-19 11:55:14
128#
 楼主| 发表于 2012-6-27 11:54 | 只看该作者
ZALBB 发表于 2012-6-27 11:23
据我的了解,10G版本只有BASIC 压缩,没有OLTP 压缩,我想知道,10G 的BASIC 压缩到了 11G 后,
会有哪些 ...

11g的compress table 定义了for all和 for direct_load两种模式,其中for all支持新的特性,而for direct_load则采用了老的算法,其实就是basic的算法。 几乎所有的新的特性都必须在for all的 参数下起效的, 而之前我们说的对DML语句压缩,这个是11g的新特性,需要在 for all的模式下执行。
回到福哥的问题,basic压缩从10g 到11g 的算法是没有变化的,所有新增的变化是放在for all的模式下


使用道具 举报

回复
论坛徽章:
67
现任管理团队成员
日期:2012-06-02 02:10:00ITPUB元老
日期:2012-09-12 14:06:14ITPUB社区千里马徽章
日期:2013-06-09 10:15:34季节之章:冬
日期:2012-09-04 11:05:30季节之章:春
日期:2012-09-05 09:20:36优秀写手
日期:2013-12-18 09:29:09马上有房
日期:2014-04-10 13:35:362014年新春福章
日期:2014-04-14 09:54:08马上有车
日期:2014-02-28 16:43:13马上加薪
日期:2014-02-19 11:55:14
129#
 楼主| 发表于 2012-6-27 11:56 | 只看该作者
ZALBB 发表于 2012-6-27 11:23
据我的了解,10G版本只有BASIC 压缩,没有OLTP 压缩,我想知道,10G 的BASIC 压缩到了 11G 后,
会有哪些 ...

Oracle原文:

if you use the compress for direct_load operations clause, you fall back to the old compression mechanism that was available in earlier releases.

使用道具 举报

回复
论坛徽章:
67
现任管理团队成员
日期:2012-06-02 02:10:00ITPUB元老
日期:2012-09-12 14:06:14ITPUB社区千里马徽章
日期:2013-06-09 10:15:34季节之章:冬
日期:2012-09-04 11:05:30季节之章:春
日期:2012-09-05 09:20:36优秀写手
日期:2013-12-18 09:29:09马上有房
日期:2014-04-10 13:35:362014年新春福章
日期:2014-04-14 09:54:08马上有车
日期:2014-02-28 16:43:13马上加薪
日期:2014-02-19 11:55:14
130#
 楼主| 发表于 2012-6-27 11:58 | 只看该作者
ZALBB 发表于 2012-6-27 11:23
据我的了解,10G版本只有BASIC 压缩,没有OLTP 压缩,我想知道,10G 的BASIC 压缩到了 11G 后,
会有哪些 ...

福哥,这个帖子大家的参与度还比较高啊,尤其是你和anlinew加入以后,还是比较热闹的,是不是考虑射个精啥的?

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表