楼主: kerlion

[精华] 100倍以上的性能提高

[复制链接]
论坛徽章:
25
ITPUB元老
日期:2005-02-28 12:57:00咸鸭蛋
日期:2013-02-07 11:51:42咸鸭蛋
日期:2013-02-08 09:48:51蜘蛛蛋
日期:2013-02-21 15:47:392013年新春福章
日期:2013-02-25 14:51:24咸鸭蛋
日期:2013-02-28 17:08:42蜘蛛蛋
日期:2013-03-29 16:17:14双黄蛋
日期:2013-04-11 16:11:04咸鸭蛋
日期:2013-05-07 11:55:14咸鸭蛋
日期:2013-05-28 10:46:24
11#
 楼主| 发表于 2002-5-23 10:16 | 只看该作者
我是拨号上去执行的,刚才有人回报,本地执行1秒都要不了,哈哈!

其实给定一个SQL和每个表的大小顺序,以及索引的情况,你应该知道怎么样是最优秀的explan.

使用道具 举报

回复
论坛徽章:
20
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:58马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:10:58
12#
发表于 2002-5-23 11:07 | 只看该作者
Hash Join does not necessary better than Nested Loop, all depends on your environment and number of records return.  There are no absoluted decision which is better than the other, you have to understand the operation first.  One thing for sure is that Nested Loop can return records faster(response time).  Hash Jion must full scan the smaller table first and build a Hash table in memory before it can return records.

使用道具 举报

回复
论坛徽章:
21
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:11:182012新春纪念徽章
日期:2012-02-13 15:11:182012新春纪念徽章
日期:2012-02-13 15:11:182012新春纪念徽章
日期:2012-02-13 15:11:18马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:11:18
13#
发表于 2002-5-23 11:15 | 只看该作者
我的感觉一般在oltp系统里面, 对于绝大多数情况还是使用nested loop比较合适.
除非有些查询例外,需要返回大量的数据, 这样nested loop反而会很慢.

使用道具 举报

回复
论坛徽章:
68
2015年新春福章
日期:2015-03-06 11:57:31奥运会纪念徽章:手球
日期:2012-09-13 15:50:49奥运会纪念徽章:水球
日期:2012-08-26 20:46:49版主1段
日期:2012-05-15 15:24:112012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-01-04 11:49:54
14#
发表于 2002-5-23 12:36 | 只看该作者

Kerlion, you are excellent!

I mean you look younger than before
But what is the meaning of "use_nl或use_hash" hash join? or hash table?

eager to learn!

使用道具 举报

回复
论坛徽章:
25
ITPUB元老
日期:2005-02-28 12:57:00咸鸭蛋
日期:2013-02-07 11:51:42咸鸭蛋
日期:2013-02-08 09:48:51蜘蛛蛋
日期:2013-02-21 15:47:392013年新春福章
日期:2013-02-25 14:51:24咸鸭蛋
日期:2013-02-28 17:08:42蜘蛛蛋
日期:2013-03-29 16:17:14双黄蛋
日期:2013-04-11 16:11:04咸鸭蛋
日期:2013-05-07 11:55:14咸鸭蛋
日期:2013-05-28 10:46:24
15#
 楼主| 发表于 2002-5-23 12:51 | 只看该作者
hash jion,

我选了个头像而也嘛。
哈哈,我只是讨厌别人叫我大叔,哈哈

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
16#
发表于 2002-5-23 13:18 | 只看该作者

呵呵,望大家都讲讲对 hash/merge/nested loop 的理解

要坚信,没有绝对好的方式
都是根据不同情况而采取不同的策略
如果固定那种方式好,相信oracle早就固化了,还用你我在这里折腾?

use_nl或use_hash  :  nested loop  /  hash
关键在于弄清楚哪种方式到底适合在什么样的情况下  

nested loop  :有索引,结果集小
merge :   ……


BTW:  对于有大量重复值的,如果采用hash是不是有不良影响?
说实在的,偶也没有真正仔细弄清楚过
抛出我的意见(砖头),望各位指正:
hash join 根据列值,按某种算法计算出列在内存中存储的位置,数据就存储在该处
当要查询或者做连接的时候,根据列值就能找着记录的位置,这样就免去了维护查找数据位置的代价,但如果重复值多的情况下,根据hash算法的特征(相同的值相当于是一个指针链表存储)
,是不是会对效率有问题

使用道具 举报

回复
论坛徽章:
25
ITPUB元老
日期:2005-02-28 12:57:00咸鸭蛋
日期:2013-02-07 11:51:42咸鸭蛋
日期:2013-02-08 09:48:51蜘蛛蛋
日期:2013-02-21 15:47:392013年新春福章
日期:2013-02-25 14:51:24咸鸭蛋
日期:2013-02-28 17:08:42蜘蛛蛋
日期:2013-03-29 16:17:14双黄蛋
日期:2013-04-11 16:11:04咸鸭蛋
日期:2013-05-07 11:55:14咸鸭蛋
日期:2013-05-28 10:46:24
17#
 楼主| 发表于 2002-5-23 13:27 | 只看该作者
nested loop:very  small row sets
hash jion: small row sets
sort merge: two tables a big

使用道具 举报

回复
论坛徽章:
68
2015年新春福章
日期:2015-03-06 11:57:31奥运会纪念徽章:手球
日期:2012-09-13 15:50:49奥运会纪念徽章:水球
日期:2012-08-26 20:46:49版主1段
日期:2012-05-15 15:24:112012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-01-04 11:49:54
18#
发表于 2002-5-23 15:17 | 只看该作者

kerlion, i am clear now!

thx and take care~!

in nowadays, nested loop can be said the worst performance among these three options.
                      hash join can be very complex or very simple. My professor told us to use it with caution.
                      merge sort or other type of sorts should be better in general case

My understanding, byw,does oralce support other typed of sorts?such as quick sort,etc?

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
19#
发表于 2002-5-24 08:03 | 只看该作者
how long can one to attain this level,
i have used oracle for 3years,but still can't do such tuning job.

使用道具 举报

回复
论坛徽章:
25
ITPUB元老
日期:2005-02-28 12:57:00咸鸭蛋
日期:2013-02-07 11:51:42咸鸭蛋
日期:2013-02-08 09:48:51蜘蛛蛋
日期:2013-02-21 15:47:392013年新春福章
日期:2013-02-25 14:51:24咸鸭蛋
日期:2013-02-28 17:08:42蜘蛛蛋
日期:2013-03-29 16:17:14双黄蛋
日期:2013-04-11 16:11:04咸鸭蛋
日期:2013-05-07 11:55:14咸鸭蛋
日期:2013-05-28 10:46:24
20#
 楼主| 发表于 2002-5-24 09:32 | 只看该作者
oralce use sort, but didint specify what kind of sort methods they use.

使用道具 举报

回复

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

本版积分规则 发表回复

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