On 06/14/2010 05:41 AM, AI Rumman wrote:
Can any one please help me in tuning the query? explain select * from (select * from crmentity where deleted = 0 and createdtime between (now() - interval '6 month') and now() ) as crmentity inner join (select * from activity where activitytype = 'Emails' and date_start between (now() - interval '6 month') and now()) as activity on crmentity.crmid=activity.activityid inner join emaildetails on emaildetails.emailid = crmentity.crmid inner join vantage_email_track on vantage_email_track.mailid=emaildetails.emailid left join seactivityrel on seactivityrel.activityid = emaildetails.emailid
Can you send us 'explain analyze' too?
-> Seq Scan on emaildetails (cost=0.00..1686.95 rows=44595 width=186) -> Seq Scan on vantage_email_track (cost=0.00..1324.52 rows=88852 width=12)
do you have indexes on emaildetails(emailid) and vantage_email_track(mailid)? -Andy -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance