pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andy Colson <andy@squeakycode.net>
To: AI Rumman <rummandba@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: query tuning help
Date: Mon, 14 Jun 2010 08:50:40 -0500
Message-ID: <4C1633B0.8090101@squeakycode.net> (raw)
In-Reply-To: <AANLkTinwmyt8mUgPkA4Kcmn3IfraIDLhT7PcYaIcVugk@mail.gmail.com>
References: <AANLkTinwmyt8mUgPkA4Kcmn3IfraIDLhT7PcYaIcVugk@mail.gmail.com>

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



view thread (22+ messages)  latest in thread

Message-ID: <4C1633B0.8090101@squeakycode.net>
Permalink:  ../4C1633B0.8090101@squeakycode.net/
Also on:    postgresql.org/message-id/4C1633B0.8090101@squeakycode.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: andy@squeakycode.net, rummandba@gmail.com
  Subject: Re: query tuning help
  In-Reply-To: <4C1633B0.8090101@squeakycode.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox