Veeru71 wrote:
Hi,
1) Is it possible to force the join order of the tables in a query
(similar to "hints" in Sybase, etc) ?
For Example, I am joining 3 tables - A,B & C in my SELECT stmt, and I
would like to force the optimizer to always join A & B first and the
results, with C.
Take a look at optimizer profiles. Should also for against DB2 V8.2
http://tinyurl.com/ylpyjt
DB2 for zOS has similar support, but I don't have the docs handy.
2) We have a number of queries in which more than 20 tables have been
joined. Is 20 too big a number ? Is there an optimal number of tables
that we can join ?
It depends on teh quality of your statistics.
As joins stack up cardinality estimates for the intermediate result sets
get more and more out of wack.
Make suer you have distribution statistics on the tables as well as
column group stats for correlated columns which are used in
join-predicates (such as maker = 'Honda' AND model = 'Accord').
Alse take a look at statistical views:
http://tinyurl.com/ye9sa2
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/