Home » RDBMS Server » Performance Tuning » saving time in query execution
saving time in query execution [message #222774] Tue, 06 March 2007 06:00 Go to next message
p.bhaskar
Messages: 33
Registered: February 2007
Location: kolkata
Member
if i have four tables.
a ---->1,00,000 data
b ---->25,000 data
c ---->2,00,000 data
d ---->3,000 data

if
i want to join a.id with c.name
and b.salary with d.name
which will be the order in where condition and what hints can be used to save time.

i have primary key on a.id
i want to know order in where clause means
will the first joining in where clause should be in a way that maximum data is returned or not?
pls explain

[Updated on: Tue, 06 March 2007 06:54]

Report message to a moderator

Re: saving time in query execution [message #222783 is a reply to message #222774] Tue, 06 March 2007 06:26 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
The order in the where clause is irrelevant for the CBO, and if your stats are up to date, you shouldn't need to use Hints.

What indexes do you have on the columns, and what additional restrictions are you going to include in the WHERE clause.
Re: saving time in query execution [message #222784 is a reply to message #222783] Tue, 06 March 2007 06:27 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Oh, and you're missing a join condition - You've got 4 tables, and it takes a minimum of 3 joins to join that many tables together - otherwise you're going to get a cartesian join, and a massive set of rows coming back.
Previous Topic: Nested loops, Hash join and Sort Merge joins – difference?
Next Topic: need suggestion on query which performs search on name
Goto Forum:
  


Current Time: Thu May 16 09:49:08 CDT 2024