473,651 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ship date);

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_ship date);

Regards,
Fan

Nov 12 '05 #1
4 2095
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_ship date);

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_ship date);

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**********@ho tmail.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_ship date);

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_ship date);

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**********@ho tmail.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_ship date);

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_ship date);

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**********@ho tmail.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**********@ho tmail.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_ship date);
>
> 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_ship date);
>
> Regards,
> Fan


Nov 12 '05 #5

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

Similar topics

1
2396
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
2344
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 optimizing.... This is what analyze shows: ------ explain analyze update activities set act_synch_date='2005-02-03 00:00:00' where activities.act_id=17; QUERY PLAN...
3
1591
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 page 19 records Clustered Index on CustomerStatusID:
15
3611
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 data. It takes about 4 minutes to get the data. In previous versions it was instantaneous. What do I need to do to increase the performance?
0
1152
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. nothing shows up. Other php scripts also show as a white page, phpinfo() will however display all the correct php variables. I'm trying to install a script called smart thumbs, midway through install it goes to a blank white page.
5
3051
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 table instead of the base table. What causes the optimizer to use the MQT tables rather than the tables as defined by the query? Is there a way to "encourage" use of the MQT tables? Thanks.
2
3902
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 still exist in MS SQL 2005? The BOL seems to be silent on the issue. Boa
3
2373
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. ------------------------- Lets say I have a table FOO1 that has, among other columns, a column named A. There is a non-unique index on A that has medium selectivity. Lets also say I have a table FOO2 that has, among other columns, a column named B. ...
20
3064
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 like 65% of the time of the second routine. Yet both do the same thing. However, the second one seems better in terms of the way the code is written since it helps encapsulate the transformation in the inner loop better making it easier to read,...
0
8277
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8803
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8700
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8465
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8581
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.