473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Which one got problem? MDC or the optimizer ...

Hi,
I have been watching MDC for a long time ... I have seen it from
INDEX-SCAN to INDEX ONLY for the DISTINCT (block index columns) operator
....
But the Elapsed time shows MDC still run slower. This did confuse me. Of
course I expected it should run faster, because of the small block index
tree, compare with the RID index tree.

select distinct(int(l_shipdate)/100)
from lineitem;

MDC Non-MDC
real 2m26.26s real 1m34.73s
user 0m0.01s user 0m0.00s
sys 0m0.01s sys 0m0.03s
IX-ONLY (l_yymm) IX-ONLY (l_shipdate)

I did a little change for the table LINEITEM.

MDC table:
CREATE TABLE LINEITEM ( L_ORDERKEY BIGINT NOT NULL,
....
L_SHIPDATE DATE NOT NULL,
....
L_COMMENT VARCHAR(44) NOT NULL,
l_yymm int not null generated always as (int(l_shipdate)/100) )
ORGANIZE BY (l_yymm)
IN SP1;
CREATE UNIQUE INDEX L_OKLN ON LINEITEM
(L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
alter table lineitem add primary key (l_orderkey, l_linenumber);
create index l_idx on lineitem(l_shipdate);

Non-MDC table
CREATE TABLE LINEITEM2 ( L_ORDERKEY BIGINT NOT NULL,
....
L_SHIPDATE DATE NOT NULL,
....
L_COMMENT VARCHAR(44) NOT NULL))
IN SP1;
CREATE UNIQUE INDEX L_OKLN ON LINEITEM
(L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
alter table lineitem add primary key (l_orderkey, l_linenumber);
create index l_idx on lineitem(l_shipdate);

Regards,
Fan

Nov 12 '05 #1
4 2074
mdc is index-mostly - not all blocks are accessed, only first one in a
select distinct for each cell (access plan should show that). Prevent
phantom values.

Fan Ruo Xin wrote:
Hi,
I have been watching MDC for a long time ... I have seen it from
INDEX-SCAN to INDEX ONLY for the DISTINCT (block index columns) operator
...
But the Elapsed time shows MDC still run slower. This did confuse me. Of
course I expected it should run faster, because of the small block index
tree, compare with the RID index tree.

select distinct(int(l_shipdate)/100)
from lineitem;

MDC Non-MDC
real 2m26.26s real 1m34.73s
user 0m0.01s user 0m0.00s
sys 0m0.01s sys 0m0.03s
IX-ONLY (l_yymm) IX-ONLY (l_shipdate)

I did a little change for the table LINEITEM.

MDC table:
CREATE TABLE LINEITEM ( L_ORDERKEY BIGINT NOT NULL,
...
L_SHIPDATE DATE NOT NULL,
...
L_COMMENT VARCHAR(44) NOT NULL,
l_yymm int not null generated always as (int(l_shipdate)/100) )
ORGANIZE BY (l_yymm)
IN SP1;
CREATE UNIQUE INDEX L_OKLN ON LINEITEM
(L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
alter table lineitem add primary key (l_orderkey, l_linenumber);
create index l_idx on lineitem(l_shipdate);

Non-MDC table
CREATE TABLE LINEITEM2 ( L_ORDERKEY BIGINT NOT NULL,
...
L_SHIPDATE DATE NOT NULL,
...
L_COMMENT VARCHAR(44) NOT NULL))
IN SP1;
CREATE UNIQUE INDEX L_OKLN ON LINEITEM
(L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
alter table lineitem add primary key (l_orderkey, l_linenumber);
create index l_idx on lineitem(l_shipdate);

Regards,
Fan


Nov 12 '05 #2
Thank you.

I think it will make more sense if we can remove the INDEX ONLY from the
dynexpln output report for SELECT DISTINCT.

And if using block index, the db2 agent still need to access the blocks (in
worst case, the number I/O reads may be equal to # of cells) to figure out the
DISTINCT value. Then if I suppose that using RID INDEX-ONLY (l_shipdate) is
better than Block INDEX-SCAN (l_yymm), does that make sense? Does the
optimizer estimate the cost of MDC overhead correctly?

Regards,
FRX

te**********@hotmail.com wrote:
mdc is index-mostly - not all blocks are accessed, only first one in a
select distinct for each cell (access plan should show that). Prevent
phantom values.

Fan Ruo Xin wrote:
Hi,
I have been watching MDC for a long time ... I have seen it from
INDEX-SCAN to INDEX ONLY for the DISTINCT (block index columns) operator
...
But the Elapsed time shows MDC still run slower. This did confuse me. Of
course I expected it should run faster, because of the small block index
tree, compare with the RID index tree.

select distinct(int(l_shipdate)/100)
from lineitem;

MDC Non-MDC
real 2m26.26s real 1m34.73s
user 0m0.01s user 0m0.00s
sys 0m0.01s sys 0m0.03s
IX-ONLY (l_yymm) IX-ONLY (l_shipdate)

I did a little change for the table LINEITEM.

MDC table:
CREATE TABLE LINEITEM ( L_ORDERKEY BIGINT NOT NULL,
...
L_SHIPDATE DATE NOT NULL,
...
L_COMMENT VARCHAR(44) NOT NULL,
l_yymm int not null generated always as (int(l_shipdate)/100) )
ORGANIZE BY (l_yymm)
IN SP1;
CREATE UNIQUE INDEX L_OKLN ON LINEITEM
(L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
alter table lineitem add primary key (l_orderkey, l_linenumber);
create index l_idx on lineitem(l_shipdate);

Non-MDC table
CREATE TABLE LINEITEM2 ( L_ORDERKEY BIGINT NOT NULL,
...
L_SHIPDATE DATE NOT NULL,
...
L_COMMENT VARCHAR(44) NOT NULL))
IN SP1;
CREATE UNIQUE INDEX L_OKLN ON LINEITEM
(L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
alter table lineitem add primary key (l_orderkey, l_linenumber);
create index l_idx on lineitem(l_shipdate);

Regards,
Fan


Nov 12 '05 #3
I understand. Yes, you can see more what is happening from the db2exfmt output. I
understand your point from dynexpln. It is an index mostly access, so not pure
index, nor ifetch and or rid-list prefetch. Yes, it is costed correctly.

Fan Ruo Xin wrote:
Thank you.

I think it will make more sense if we can remove the INDEX ONLY from the
dynexpln output report for SELECT DISTINCT.

And if using block index, the db2 agent still need to access the blocks (in
worst case, the number I/O reads may be equal to # of cells) to figure out the
DISTINCT value. Then if I suppose that using RID INDEX-ONLY (l_shipdate) is
better than Block INDEX-SCAN (l_yymm), does that make sense? Does the
optimizer estimate the cost of MDC overhead correctly?

Regards,
FRX

te**********@hotmail.com wrote:
mdc is index-mostly - not all blocks are accessed, only first one in a
select distinct for each cell (access plan should show that). Prevent
phantom values.

Fan Ruo Xin wrote:
Hi,
I have been watching MDC for a long time ... I have seen it from
INDEX-SCAN to INDEX ONLY for the DISTINCT (block index columns) operator
...
But the Elapsed time shows MDC still run slower. This did confuse me. Of
course I expected it should run faster, because of the small block index
tree, compare with the RID index tree.

select distinct(int(l_shipdate)/100)
from lineitem;

MDC Non-MDC
real 2m26.26s real 1m34.73s
user 0m0.01s user 0m0.00s
sys 0m0.01s sys 0m0.03s
IX-ONLY (l_yymm) IX-ONLY (l_shipdate)

I did a little change for the table LINEITEM.

MDC table:
CREATE TABLE LINEITEM ( L_ORDERKEY BIGINT NOT NULL,
...
L_SHIPDATE DATE NOT NULL,
...
L_COMMENT VARCHAR(44) NOT NULL,
l_yymm int not null generated always as (int(l_shipdate)/100) )
ORGANIZE BY (l_yymm)
IN SP1;
CREATE UNIQUE INDEX L_OKLN ON LINEITEM
(L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
alter table lineitem add primary key (l_orderkey, l_linenumber);
create index l_idx on lineitem(l_shipdate);

Non-MDC table
CREATE TABLE LINEITEM2 ( L_ORDERKEY BIGINT NOT NULL,
...
L_SHIPDATE DATE NOT NULL,
...
L_COMMENT VARCHAR(44) NOT NULL))
IN SP1;
CREATE UNIQUE INDEX L_OKLN ON LINEITEM
(L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
alter table lineitem add primary key (l_orderkey, l_linenumber);
create index l_idx on lineitem(l_shipdate);

Regards,
Fan


Nov 12 '05 #4

Sometimes I am not sure if optimizer estimates the cost of MDC overhead correctly,
especially if the query need to touch almost all the blocks (either only a small
number of rows of the block, or all the rows of the block), and through Block Index
Scan.
For my case, maybe it is because of the Cell size of the MDC which I created is
relatively bigger.
Thanks,
FRX

te**********@hotmail.com wrote:
I understand. Yes, you can see more what is happening from the db2exfmt output. I
understand your point from dynexpln. It is an index mostly access, so not pure
index, nor ifetch and or rid-list prefetch. Yes, it is costed correctly.

Fan Ruo Xin wrote:
Thank you.

I think it will make more sense if we can remove the INDEX ONLY from the
dynexpln output report for SELECT DISTINCT.

And if using block index, the db2 agent still need to access the blocks (in
worst case, the number I/O reads may be equal to # of cells) to figure out the
DISTINCT value. Then if I suppose that using RID INDEX-ONLY (l_shipdate) is
better than Block INDEX-SCAN (l_yymm), does that make sense? Does the
optimizer estimate the cost of MDC overhead correctly?

Regards,
FRX

te**********@hotmail.com wrote:
mdc is index-mostly - not all blocks are accessed, only first one in a
select distinct for each cell (access plan should show that). Prevent
phantom values.

Fan Ruo Xin wrote:

> Hi,
> I have been watching MDC for a long time ... I have seen it from
> INDEX-SCAN to INDEX ONLY for the DISTINCT (block index columns) operator
> ...
> But the Elapsed time shows MDC still run slower. This did confuse me. Of
> course I expected it should run faster, because of the small block index
> tree, compare with the RID index tree.
>
> select distinct(int(l_shipdate)/100)
> from lineitem;
>
> MDC Non-MDC
> real 2m26.26s real 1m34.73s
> user 0m0.01s user 0m0.00s
> sys 0m0.01s sys 0m0.03s
> IX-ONLY (l_yymm) IX-ONLY (l_shipdate)
>
> I did a little change for the table LINEITEM.
>
> MDC table:
> CREATE TABLE LINEITEM ( L_ORDERKEY BIGINT NOT NULL,
> ...
> L_SHIPDATE DATE NOT NULL,
> ...
> L_COMMENT VARCHAR(44) NOT NULL,
> l_yymm int not null generated always as (int(l_shipdate)/100) )
> ORGANIZE BY (l_yymm)
> IN SP1;
> CREATE UNIQUE INDEX L_OKLN ON LINEITEM
> (L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
> alter table lineitem add primary key (l_orderkey, l_linenumber);
> create index l_idx on lineitem(l_shipdate);
>
> Non-MDC table
> CREATE TABLE LINEITEM2 ( L_ORDERKEY BIGINT NOT NULL,
> ...
> L_SHIPDATE DATE NOT NULL,
> ...
> L_COMMENT VARCHAR(44) NOT NULL))
> IN SP1;
> CREATE UNIQUE INDEX L_OKLN ON LINEITEM
> (L_ORDERKEY ASC, L_LINENUMBER ASC) PCTFREE 0 ;
> alter table lineitem add primary key (l_orderkey, l_linenumber);
> create index l_idx on lineitem(l_shipdate);
>
> Regards,
> Fan


Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nick Mudge | last post by:
Hi, Does anybody know the performance difference between having your PHP code cached and just running your code with the zend optimizer? Is there much difference? Nick
2
by: gefek | last post by:
Hello, I've got a server postgresql 7.4.6 installed from RPM for linux RH 9. Lately, I've noticed, that some queries last too long... It appears to me, that the optimizer does not use index...
3
by: Philip Yale | last post by:
I'm very puzzled by the choice of NC index being made by the optimizer in this example. I don't actually think it should use an NC index at all. I have: Table: CustomerStatus_T Single data...
15
by: Hemant Shah | last post by:
Folks, We have an SQL statement that was coded in an application many years ago (starting with DB V2 I think). When I upgraded to UDB 8.2, the optimizer does not use optimal path to access the...
0
by: russellwesthaven | last post by:
I'm trying to load the latest version of the optimizer. I know that I'm specifying the correct php.ini location. After installing the optimizer, if I go back to servercheck.php it's just white....
5
by: Kevin | last post by:
Using a base table, a MQT table was created. With optimization - when querying the base table with calcuation that are already completed in the MQT - I would assume the optimizer would use the MQT...
2
by: boa sema | last post by:
Way back when, and at least in version 7 IIRC, the query optimizer gave up when the where clause in a statement contained more than 4 search conditions. Does anyone know if such a limitation...
3
by: aj | last post by:
DB2 LUW v8.2 FP 14 RHAS 2.1 Sorry if these are newbie questions. Optimizer stuff is black magic to me. For both of these, assume stats are current and an even distribution of data....
20
by: mike3 | last post by:
Hi. (Xposted to both comp.lang.c++ and comp.programming since I've got questions related to both C++ language and general programming) I've got the following C++ code. The first routine runs in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.