Quantcast
Channel: Go4Expert
Viewing all articles
Browse latest Browse all 1994

How to Tune SQL with OR statements?

$
0
0
It is common that the performance is not good if a SQL statement with OR conditions. Let’s have an example show you how to tune those SQL statements in certain situations.
Here is an example SQL that extract records from EMPLOYEE table if (emp_grade < 1050 or emp_id<730000). Emp_grade and emp_id are indexed and they are not null field.

select * from employee
where emp_grade < 1050 or emp_id<730000
[​IMG]
You can see MySQL...

How to Tune SQL with OR statements?

Viewing all articles
Browse latest Browse all 1994

Trending Articles