From: Shaun Thomas <sthomas@optionshouse.com>
To: Andrew Jaimes <andrewjaimes@hotmail.com>
Cc: Postgres Performance <pgsql-performance@postgresql.org>
Subject: Re: Sequencial scan in a JOIN
Date: Tue, 5 Jun 2012 09:02:08 -0500
Message-ID: <4FCE1160.4070003@optionshouse.com> (raw)
In-Reply-To: <BLU161-W5750D54FD724EB2412564CDD0C0@phx.gbl>
References: <BLU161-W1125BE7D5AED110518DEFFDD0C0@phx.gbl>
<4FCE0681.5040306@optionshouse.com>
<BLU161-W5750D54FD724EB2412564CDD0C0@phx.gbl>
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
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: sthomas@optionshouse.com, andrewjaimes@hotmail.com
Subject: Re: Sequencial scan in a JOIN
In-Reply-To: <4FCE1160.4070003@optionshouse.com>
* 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