Re: Sequencial scan in a JOIN

Поиск
Список
Период
Сортировка
От Shaun Thomas
Тема Re: Sequencial scan in a JOIN
Дата
Msg-id 4FCE1160.4070003@optionshouse.com
обсуждение исходный текст
Ответ на Re: Sequencial scan in a JOIN  (Andrew Jaimes <andrewjaimes@hotmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Andrew Jaimes
Дата:
Сообщение: Re: Sequencial scan in a JOIN
Следующее
От: Shaun Thomas
Дата:
Сообщение: Re: Sequencial scan in a JOIN