Home » RDBMS Server » Server Utilities » SQL query with search conditions to filter rows
SQL query with search conditions to filter rows [message #70148] Mon, 22 April 2002 02:02 Go to next message
Vidyavati
Messages: 14
Registered: April 2002
Junior Member
Hi All,

Can anybody help me with the following issue...

i have 2 simple queries on a simple table...

Query 1 : SELECT Col1, Col2, Col3
FROM TABLE1
WHERE Col4='abc';

Query 2 : SELECT Col1, Col2, Col3
FROM TABLE1
WHERE Col1='123' AND Col2='546'
OR Col3='xyz' AND Col5='pqr'
OR Col6='1abc'
OR Col4='abc';

It has been observed that the execution of Query 2 takes much longer time than the execution of Query 1.
Is there any specific reason for the poor performance of Query 2 ??
Can you suggest something (rephrasing the Query 2) so that the execution time of Query 1 and Query 2 are comparable.

Thanks in advance,

With Regards,
Vidya
Re: SQL query with search conditions to filter rows [message #70149 is a reply to message #70148] Mon, 22 April 2002 04:48 Go to previous message
Vikas Gupta
Messages: 115
Registered: February 2002
Senior Member
I think you should make use of brackets, so that it is clear.
You should also have a composite index. Try various combinations and use explain plan. This will help u
to get to the optimum statement.
Previous Topic: Export/Import Utilities
Next Topic: Re: Oracle problem
Goto Forum:
  


Current Time: Fri Apr 26 20:32:04 CDT 2024