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 4 2043
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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
|
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...
|
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...
|
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...
|
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....
|
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...
|
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...
|
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....
|
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...
|
by: Rina0 |
last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |