> > hi,
> >
[quoted text clipped - 7 lines]
> It would help if you could post the DDL for the table and indexes (and
> MDC), and the DML for the SQL query.
ok
due to buisness reasons, i can not post ddl and sql but i can try to
give example close to real situation
table A | table B | table C
aa int, | ba int, | ca int,
ab int, | bb int, | cb int,
ac int, | bc date | cc int,
ad date, | | cd date
ae date, | |
af date, | |
ag date | |
there is mdc on each table on column ad date, bc date, cd date
there is regular index like
index a on table a
aa asc, ab asc, ac asc
index b on table b
ba asc, bb asc
index c on table c
ca asc, cb asc, cc asc
and sql is like
select (some coulmns from table a,b,c) from a,b,c
where a.aa = b.ba and a.ab = b.bb and a.aa = c.ca and a.ab = c.cb
and ag between (current date - 42 months) and (current date)
and bc between (current date - 42 months) and (current date)
now it is using dimansional block index because its cluster ratio is
100% but skipping index a or b or c which has column used in join
those indexes has bad cluster ratio which can not avoided
how should i go about this
i think sql will improve if it use regular indexes along with block
indexes
db2admin - 02 Jun 2006 21:53 GMT
> > > hi,
> > >
[quoted text clipped - 49 lines]
> i think sql will improve if it use regular indexes along with block
> indexes
it does tablescan even if i do not use dimension column in my sql
ChrisC - 05 Jun 2006 16:30 GMT
> i think sql will improve if it use regular indexes along with block
> indexes
Actually, I wouldn't be suprised if skipping the indexes and doing full
table scans isn't the best choice. Looking at the query, the only
limiting columns are against ag (which isn't indexed), and bc (which is
the MDC column). However, bc is for 3 1/2 years of data - just how
much data do you have in this table? If it's only4 years or so, this
isn't selective enough for DB2 to bother with - it would likely return
most of the data in any case. If you have 20-30 years of data in
there, then it might make sense to use the MDC to filter this -
assuming that the 3-1/2 years of data is a small enough percentage of
the data (maybe < 50%, max). Then it should use the other indexes for
joining, most likely.
Otherwise, DB2 probably thinks it will need to pull in all the data
from all the tables to do the joins - and in that case, doing table
scans is definitely more effecient than running the indexes (since
those indexes are not clustered).
-Chris
db2admin - 05 Jun 2006 19:31 GMT
> > i think sql will improve if it use regular indexes along with block
> > indexes
[quoted text clipped - 17 lines]
>
> -Chris
i am sorry
i was not ag
it was ad ( mdc index )