Re: Sequencial scan in a JOIN - Mailing list pgsql-performance

From Shaun Thomas
Subject Re: Sequencial scan in a JOIN
Date
Msg-id 4FCE1160.4070003@optionshouse.com
Whole thread Raw
In response to Re: Sequencial scan in a JOIN  (Andrew Jaimes <andrewjaimes@hotmail.com>)
List pgsql-performance
On 06/05/2012 08:31 AM, Andrew Jaimes wrote:

> the default_statistics_target is set to 200, and I have run the analyze
> and reindex on these tables before writing the email.

Out of idle curiosity, how do these two variants treat you?

SELECT count(1)
   FROM e_usersessions s
   JOIN l_userqueue q ON (q.userid = s.entityid)
   JOIN a_activity a ON (a.activequeueid = q.queueid)
  WHERE s.sessionkeepalivedatetime > 20120605082131943
    AND a.vstatus        = 1
    AND a.ventrydate     > 0
    AND a.sbuid          = s.sbuid
    AND a.assignedtoid   = 0
    AND a.status        <> '0'

SELECT count(1)
   FROM e_usersessions s
   JOIN l_userqueue q ON (q.userid = s.entityid)
  WHERE s.sessionkeepalivedatetime > 20120605082131943
    AND EXISTS (
          SELECT 1 FROM a_activity a
           WHERE a.activequeueid = q.queueid
             AND a.sbuid         = s.sbuid
             AND a.vstatus       = 1
             AND a.ventrydate    > 0
             AND a.assignedtoid  = 0
             AND a.status       <> '0'
        )

--
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604
312-444-8534
sthomas@optionshouse.com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email

pgsql-performance by date:

Previous
From: Andrew Jaimes
Date:
Subject: Re: Sequencial scan in a JOIN
Next
From: Shaun Thomas
Date:
Subject: Re: Sequencial scan in a JOIN