hi everybody i am using this(below) SQL query for searching some data but as i have used some joins and there are huge number of records it is giving me performance problem so can any body help me how can i optimize this query..every response is highly appreciated..
if i am searching a then this will be the query
select DISTINCT p.PolicyID "Policy ID", p.CustomerRef "Customer Reference", ct.Cover "Cover", p.Start_Date "Start Date", p.End_Date "End Date",p.No_of_Months "Term", p.DateCancelled "Cancelled Date"
from USER p inner join USER_TYPES ct on p.Cover = ct.CoverID, USER_AGENT sa
where sa.AgentID= p.AgentID and sa.BASE_CODE in ( 'ABC001' ) and ( p.PolicyID RLIKE '[[:<:]]a[[:>:]]' or p.Title RLIKE '[[:<:]]a[[:>:]]' or p.CustomerRef RLIKE '[[:<:]]a[[:>:]]' or p.Start_Date RLIKE '[[:<:]]a[[:>:]]' or p.End_Date RLIKE '[[:<:]]a[[:>:]]' order by 'Policy ID' limit ?,?