Home > Database > Mysql Tutorial > body text

通过一个案例彻底读懂10046trace--字节级深入破解

WBOY
Release: 2016-06-07 15:58:45
Original
1443 people have browsed it

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/37840583 2014.7.23晚20:30 Oracle support组猫大师分享《通过一个案例彻底读懂10046 trace--字节级深入破解》 如需了解更多课程请登录网站http://www.jianfengedu.com/Discuz/detail/id/56

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/37840583

2014.7.23晚20:30 Oracle support组猫大师分享《通过一个案例彻底读懂10046 trace--字节级深入破解》

如需了解更多课程请登录网站http://www.jianfengedu.com/Discuz/detail/id/56

国内首创成就QTune的顶级高手之课

SQL优化课程系列I CBO内部算法

--》能从头听到尾, 真的能成QTune高手

我只提一个问题, 有谁能把> 的选择率真的搞清楚? DIS上都没有讲清楚。 

+++我给你看个东西

--------------------------------------------------------------------------
| Id  | Operation	  | Name | Rows  | Bytes | Cost (%CPU)| Time	 |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |	 |     1 |    10 |   349   (1)| 00:00:05 |
|*  1 |  TABLE ACCESS FULL| T1	 |     1 |    10 |   349   (1)| 00:00:05 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter("OBJECT_NAME"='00440')

table name:T1
column name:OBJECT_NAME
num_rows:87417
num distinct:48128
num_nulls:797
density:.0000115446779034865
histogram:HEIGHT BALANCED
high_value:4435(D5) -- internal value:354151154089362000000000000000000000
low_value:3030343432(00442) -- internal value:250207940888765000000000000000000000

00400 internal Value : 250207940886347000000000000000000000

ENDPOINT_VALUE	     ENDPOINT_NUMBER BUCKET_COUNT
-------------------- --------------- ------------
46641				  40		1
47796				  41		1
A1				  49		8
B2				  58		9
C3				  66		8
D5				  75		9
Copy after login

Density = (Bucket_total - Buckets_all_popular_value)/

Sel = .00001136 * (87417 - 797)/87417 * (1 - ((250207940888765000000000000000000000 - 250207940886347000000000000000000000)/(354151154089362000000000000000000000 - 250207940888765000000000000000000000)))

这是:col=val and val2*low_value - high_value

high_value:4435(D5) -- internal value:354151154089362000000000000000000000

00400 internal Value : 250207940886347000000000000000000000

这三个数字是怎么得出来的?

D5在dba_tab_columns里,存成这样的:4435, 其实oracle内部计算用的值是:354151154089362000000000000000000000

与其实, 他在告诉你怎么COST,不如说,他是想告诉你, 怎么研究oracle的算法。

其实就是告诉你, 怎么猜。 里面也有错的。

比如cardinality他都是用ceil()一下, 其实,oracle多数情况下用round 

大家是否面对生产上很慢的SQL束手无策,经常碰到类似下面的一些问题,这里我只是举例。。。

DSI之 系列1 CBO内部算法--2014.8.5启动(14课时,7天课),¥499/每人

选择率,基数计算公式

 1. 重要的概念

Join

5. Hash Join and Sort Merge Join

———————————————最近分享活动视频
caibird2005分享主题《数据仓库环境的表拆分、分区表、并行计算 》

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template