Re: Query Is to Slow
Posted by:
Rick James
Date: October 30, 2012 11:48AM
OR is often a performance killer. Sometimes UNION is the solution:
select distinct concat(users.first_name, " ", users.last_name) as Name
from users
left join tasks on users.id = tasks.created_by
where (tasks.date_start between @start and @stop)
order by concat(users.first_name, " ", users.last_name) ;
UNION DISTINCT
select distinct concat(users.first_name, " ", users.last_name) as Name
from users
left join meetings on users.id = meetings.created_by
where (meetings.date_start between @start and @stop)
order by concat(users.first_name, " ", users.last_name) ;
Subject
Views
Written By
Posted
1521
October 29, 2012 05:47AM
767
October 29, 2012 05:58AM
Re: Query Is to Slow
828
October 30, 2012 11:48AM
766
October 30, 2012 11:53AM
747
October 31, 2012 08:13AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.