祝愿大家身体健康!

 站点注册  找回密码
 站点注册

QQ登录

只需一步,快速开始

查看: 3909|回复: 5

请各位帮我分析一下dbcc tranceon(3604,302,310) 的结果

[复制链接]

请各位帮我分析一下dbcc tranceon(3604,302,310) 的结果

[复制链接]
my_reg

主题

0

回帖

14

积分

新手上路

积分
14
贡献
在线时间
小时
2007-1-29 19:24:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?站点注册

×

select count(*) from T_Basic a,T_EStatus b where a.EID =b.EID

下面是我执行这条语句的跟踪结果,T_Basic和T_EStatus 都 有150万条数据,两张表的EID都是索引,大概执行15秒。

*******************************
Beginning selection of qualifying indexes for table 'T_Basic',
correlation name 'a', varno = 0, objectid 1856006612.
   The table (Datarows) has 461020 rows, 106683 pages,
   The table's Data Page Cluster Ratio 0.999990

Table scan cost is 461020 rows, 107416 pages,
   using data prefetch (size 16K I/O),
   in data cache 'bizcache' (cacheid 1) with MRU replacement


Index selection finished for table 'T_Basic' (objectid 1856006612).


The best qualifying  index is 'T_18560066121' (indid 5)
   costing 6570 pages,
   with an estimate of 461020 rows to be returned per scan of the table,
   using index prefetch (size 16K I/O) on leaf pages,
   in index cache 'bizcache' (cacheid 1) with LRU replacement

Index covers query.
Search argumE selectivity is 1.000000.

*******************************

*******************************
Beginning selection of qualifying indexes for table 'T_EStatus',
correlation name 'b', varno = 1, objectid 2080007410.
   The table (Datarows) has 1419841 rows, 57705 pages,
   The table's Data Page Cluster Ratio 0.999723
   The table has 20 partitions.
   The largest partition has 57666 pages.
   The partition skew is 19.514721.


Table scan cost is 1419841 rows, 59081 pages,
   using data prefetch (size 16K I/O),
   in data cache 'bizcache' (cacheid 1) with MRU replacement

Index selection finished for table 'T_EStatus' (objectid 2080007410).

The best qualifying  index is 'id_Eid' (indid 3)
   costing 21347 pages,
   with an estimate of 1419841 rows to be returned per scan of the table,
   using index prefetch (size 16K I/O) on leaf pages,
   in index cache 'bizcache' (cacheid 1) with LRU replacement
Index covers query.
Search argumE selectivity is 1.000000.

*******************************

*******************************
Beginning selection of qualifying indexes for table 'T_Basic',
correlation name 'a', varno = 0, objectid 1856006612.
   The table (Datarows) has 461020 rows, 106683 pages,
   The table's Data Page Cluster Ratio 0.999990


Table scan cost is 461020 rows, 107416 pages,
   using data prefetch (size 16K I/O),
   in data cache 'bizcache' (cacheid 1) with MRU replacement

Selecting best index for the JOIN CLAUSE:
 T_Basic.EID = b.EID

Estimated selectivity for EID,
   selectivity = 0.000002.
Unique nonclustered index found, returns 1 row, 4 pages

Estimating selectivity of index 'T_18560066121', indid 5
   scan selectivity 0.000002, filter selectivity 0.000002 
   1 rows, 4 pages, index height 3,
   Data Row Cluster Ratio 0.997759,
   Index Page Cluster Ratio 0.932301,
   Data Page Cluster Ratio 0.991322

The best qualifying Nested Loop join index is 'T_18560066121' (indid 5)
   costing 4 pages,
   with an estimate of 1 rows to be returned per scan of the table,
   using no index prefetch (size 2K I/O) on leaf pages,
   in index cache 'bizcache' (cacheid 1) with LRU replacement
Index covers query.
Join selectivity is 0.000002.

If this access path is selected for a merge join, this table will be sorted.

*******************************

*******************************
Beginning selection of qualifying indexes for table 'T_EStatus',
correlation name 'b', varno = 1, objectid 2080007410.
   The table (Datarows) has 1419841 rows, 57705 pages,
   The table's Data Page Cluster Ratio 0.999723
   The table has 20 partitions.
   The largest partition has 57666 pages.
   The partition skew is 19.514721.


Table scan cost is 1419841 rows, 59081 pages,
   using data prefetch (size 16K I/O),
   in data cache 'bizcache' (cacheid 1) with MRU replacement

Selecting best index for the JOIN CLAUSE:
 T_EStatus.EID = a.EID

Estimated selectivity for EID,
   selectivity = 0.000001.

Estimating selectivity of index 'id_Eid', indid 3
   scan selectivity 0.000001, filter selectivity 0.000001 
   1 rows, 4 pages, index height 3,
   Data Row Cluster Ratio 0.489111,
   Index Page Cluster Ratio 0.976601,
   Data Page Cluster Ratio 0.350660

The best qualifying Nested Loop join index is 'id_Eid' (indid 3)
   costing 4 pages,
   with an estimate of 1 rows to be returned per scan of the table,
   using no index prefetch (size 2K I/O) on leaf pages,
   in index cache 'bizcache' (cacheid 1) with LRU replacement
Index covers query.
Join selectivity is 0.000001.

If this access path is selected for a merge join, this table will be sorted.

*******************************


QUERY IS CONNECTED
Number of tables in join: 2
Number of tables considered at a time: 2
Table count setting: 0 (default value used)

 0 - 1 -

NEW PLAN (total cost = 3780590):

varno=0 (T_Basic) indexid=5 (T_18560066121)
path=0x2981B4EC pathtype=sclause
method=NESTED ITERATION 
scanthreads=1
outerrows=1 rows=461020 joinsel=1.000000 scanpgs=6570
index_prefetch=YES index_iosize=16 index_bufreplace=LRU
scanlio=6570 scanpio=1300
corder=1

varno=1 (T_EStatus) indexid=3 (id_Eid)
path=0x2679B000 pathtype=join
method=NESTED ITERATION 
scanthreads=1
outerrows=461020 rows=462472 joinsel=0.000001 jnpgs_per_scan=4
index_prefetch=YES index_iosize=16 index_bufreplace=LRU
scanlio=1844080 scanpio=3105
corder=3

jnvar=0 refcost=0 refpages=0 reftotpages=16920 ordercol[0]=3  ordercol[1]=1

 1 - 0 -

TOTAL # PERMUTATIONS: 2

TOTAL # PLANS CONSIDERED: 12

CACHE USED BY THIS PLAN:

 CacheID = 1: (2K) 0 (4K) 0 (8K) 0 (16K) 27917

FINAL PLAN (total cost = 3780590):


varno=0 (T_Basic) indexid=5 (T_18560066121)
path=0x2981B4EC pathtype=sclause
method=NESTED ITERATION 
scanthreads=1
outerrows=1 rows=461020 joinsel=1.000000 scanpgs=6570
index_prefetch=YES index_iosize=16 index_bufreplace=LRU
scanlio=6570 scanpio=1300
corder=1

varno=1 (T_EStatus) indexid=3 (id_Eid)
path=0x2679B000 pathtype=join
method=NESTED ITERATION 
scanthreads=1
outerrows=461020 rows=462472 joinsel=0.000001 jnpgs_per_scan=4
index_prefetch=YES index_iosize=16 index_bufreplace=LRU
scanlio=1844080 scanpio=3105
corder=3

jnvar=0 refcost=0 refpages=0 reftotpages=16920 ordercol[0]=3  ordercol[1]=1

共享共进共赢Sharing And Win-win Results
SYBASEBBS - 免责申明1、欢迎访问“SYBASEBBS.COM”,本文内容及相关资源来源于网络,版权归版权方所有!本站原创内容版权归本站所有,请勿转载!
2、本文内容仅代表作者观点,不代表本站立场,作者自负,本站资源仅供学习研究,请勿非法使用,否则后果自负!请下载后24小时内删除!
3、本文内容,包括但不限于源码、文字、图片等,仅供参考。本站不对其安全性,正确性等作出保证。但本站会尽量审核会员发表的内容。
4、如本帖侵犯到任何版权问题,请立即告知本站 ,本站将及时删除并致以最深的歉意!客服邮箱:admin@sybasebbs.com
flybean

主题

0

回帖

595

积分

管理员

积分
595
贡献
在线时间
小时
2007-2-2 13:58:46 | 显示全部楼层
如何优化,是要根据你的主要业务来定,而不定某一句随便的SQL
共享共进共赢Sharing And Win-win Results
flybean

主题

0

回帖

595

积分

管理员

积分
595
贡献
在线时间
小时
2007-1-30 11:41:16 | 显示全部楼层
嘛目的?
共享共进共赢Sharing And Win-win Results
my_reg 楼主

主题

0

回帖

14

积分

新手上路

积分
14
贡献
在线时间
小时
2007-1-30 14:17:08 | 显示全部楼层
感觉查询有点慢,想找一下原因,看能否优化一下。
共享共进共赢Sharing And Win-win Results
flybean

主题

0

回帖

595

积分

管理员

积分
595
贡献
在线时间
小时
2007-1-31 12:59:01 | 显示全部楼层
也没有都150W嘛,一个 4x W,一个 14x W,一对多,
共享共进共赢Sharing And Win-win Results
my_reg 楼主

主题

0

回帖

14

积分

新手上路

积分
14
贡献
在线时间
小时
2007-1-31 13:11:52 | 显示全部楼层
这是我用的另一个测试库做的,理论上这两张表数据行数应该是一样的,现在真实库中大概都有140多万条。这条语句还是最简单的,查询起来都很慢,复杂的查询就更慢了。
共享共进共赢Sharing And Win-win Results
您需要登录后才可以回帖 登录 | 站点注册

本版积分规则

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com

QQ|Archiver|PowerBuilder(PB)BBS社区 ( 鲁ICP备2021027222号-1 )

GMT+8, 2024-11-22 21:34 , Processed in 0.041253 second(s), 7 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表