473,287 Members | 1,663 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,287 software developers and data experts.

How to force the join order ?

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.

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 ?

Thanks in advance
- Murty

Oct 16 '06 #1
2 3862
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/
Oct 16 '06 #2
Serge Rielau wrote:
Alse take a look at statistical views: http://tinyurl.com/ye9sa2
Very interesting. Are statistical views only available in V9, or are
they also available in some flavor of V8?

-Chris

Oct 16 '06 #3

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

Similar topics

2
by: Pierre Fortin | last post by:
This quest for understanding started very innocently... A simple error on my part, passing on args as "args" instead of "*args" to os.path.join() led me to wonder why an error wasn't raised... ...
0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
2
by: Bruce Duncan | last post by:
I'm a bit new to MySQL (know MS SQL well...and that may be the problem...getting the syntax confused) and I'm having a join problem...can anyone offer some help? Here's my problem: I have table1...
6
by: tracy | last post by:
I have a complex query (16 table join) that until five days ago took 30 sec to run. It now takes eight hours. I restored a backup of the database from five days ago and the query plans are...
12
by: Phil Powell | last post by:
<cfquery name="getAll" datasource="#request.dsn#"> SELECT U.userID, U.fname, U.lname, U.phone, U.lastLoggedIn, U.choiceId, U.experience, T.label AS teamLabel, R.label AS roleLabel FROM User U...
4
by: Bob Quintal | last post by:
Have two tables linked from SQL server into Access '97, one containing an autonumber primary key and the second table has a text field populated with cstr(). I can create a query that contains...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
7
by: Dave | last post by:
I have a database with 3 tables, one for nominees, one for voters and one for votes. I used the following syntax SELECT `tblnominees`.`fldNominee`, Count(`tblvotes`.`fldVote`) AS...
5
code green
by: code green | last post by:
I cannot get the following query correct. Please can somebody put me right SELECT , FROM INNER JOIN ON . = . INNER JOIN ON . = . INNER JOIN invoice ON . = . INNER JOIN deliver ON . =...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.