Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For execution performance

Status
Not open for further replies.

leo6

Programmer
Mar 2, 2005
22
US
I was looking for performance improvement on this...
Is it possible ???

select a.col1 , a.col2
from tab1 a, tab2 b
where a.col3=b.col3
and a.col4 = <constant>
 
Could try swapping around the where clauses to see if that has any effect i.e.
Code:
where a.col4 = <constant>
and a.col3=b.col3

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Swapping doesn't matter - AND operator is commutative and optimizer usually picks the least costly part to evaluate first.

Try with index on a.col3 or a.col4.

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.
 
Check the execution plan. If you're getting a table scan or clustered index scan for either table, you may want to add an index. Good luck!

--John [rainbow]
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top