I have 2 databases with the same layout (but slightly different data)
on 2 different servers. I have a query I'm trying to run which
performs poorly on one of the servers due to sort issues, but performs
fine on the other server. Here's a portion of the query plan I'm
seeing on the good performing server:
FETCH
( 12)
70.0116
5.1845
/---+---\
1.66958 4.27945e+07
IXSCAN TABLE: USERID
( 13) STD_DEMO_DATA
48.5708
3.51655
|
4.27945e+07
INDEX: USERID
SFRD
This is what I would expect to see and this is good. But on the other
server, the same query gives me this:
FETCH
( 12)
47.2245
34
/---+---\
74.4065 6.90179e+07
RIDSCN TABLE: USERID
( 13) STD_DEMO_DATA
15.1934
2
|
74.4065
SORT
( 14)
15.1904
2
|
74.4065
IXSCAN
( 15)
15.1687
2
|
6.90179e+07
INDEX: USERID
SFRD
This is evil. Now, I might expect this if my data were not clustered
by the SFRD index, but it is as you can see by this snippet of
reorgchk:
SCHEMA.NAME INDCARD LEAF ELEAF LVLS NDEL KEYS
LEAF_RECSIZE NLEAF_RECSIZE LEAF_PAGE_OVERH EAD NLEAF_PAGE_OVER HEAD F4
F5 F6 F7 F8 REORG
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Table: USERID.STD_DEMO _DATA
Index: USERID.SFRD
6.9e+07 86265 0 3 0
7425364 9 9 1048
1048 99 91 0 0 0 -----
As you can hopefully see, this shows that I am 99% clustered on that
index. Now, there is no clustering index, but given I'm 99%
clustered, does that matter? What am I missing that is influencing
the optimizer to pick the poor plan when I'm 99% clustered.
Thanks in advance for any help,
Greig Wise -- DBA Manager
on 2 different servers. I have a query I'm trying to run which
performs poorly on one of the servers due to sort issues, but performs
fine on the other server. Here's a portion of the query plan I'm
seeing on the good performing server:
FETCH
( 12)
70.0116
5.1845
/---+---\
1.66958 4.27945e+07
IXSCAN TABLE: USERID
( 13) STD_DEMO_DATA
48.5708
3.51655
|
4.27945e+07
INDEX: USERID
SFRD
This is what I would expect to see and this is good. But on the other
server, the same query gives me this:
FETCH
( 12)
47.2245
34
/---+---\
74.4065 6.90179e+07
RIDSCN TABLE: USERID
( 13) STD_DEMO_DATA
15.1934
2
|
74.4065
SORT
( 14)
15.1904
2
|
74.4065
IXSCAN
( 15)
15.1687
2
|
6.90179e+07
INDEX: USERID
SFRD
This is evil. Now, I might expect this if my data were not clustered
by the SFRD index, but it is as you can see by this snippet of
reorgchk:
SCHEMA.NAME INDCARD LEAF ELEAF LVLS NDEL KEYS
LEAF_RECSIZE NLEAF_RECSIZE LEAF_PAGE_OVERH EAD NLEAF_PAGE_OVER HEAD F4
F5 F6 F7 F8 REORG
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Table: USERID.STD_DEMO _DATA
Index: USERID.SFRD
6.9e+07 86265 0 3 0
7425364 9 9 1048
1048 99 91 0 0 0 -----
As you can hopefully see, this shows that I am 99% clustered on that
index. Now, there is no clustering index, but given I'm 99%
clustered, does that matter? What am I missing that is influencing
the optimizer to pick the poor plan when I'm 99% clustered.
Thanks in advance for any help,
Greig Wise -- DBA Manager
Comment