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

From Andrew Jaimes
Subject Re: Sequencial scan in a JOIN
Date
Msg-id BLU161-W5750D54FD724EB2412564CDD0C0@phx.gbl
Whole thread Raw
In response to Re: Sequencial scan in a JOIN  (Shaun Thomas <sthomas@optionshouse.com>)
Responses Re: Sequencial scan in a JOIN  (Shaun Thomas <sthomas@optionshouse.com>)
List pgsql-performance
the default_statistics_target is set to 200, and I have run the analyze and reindex on these tables before writing the email.


Andrew

> Date: Tue, 5 Jun 2012 08:15:45 -0500
> From: sthomas@optionshouse.com
> To: andrewjaimes@hotmail.com
> CC: pgsql-performance@postgresql.org
> Subject: Re: [PERFORM] Sequencial scan in a JOIN
>
> On 06/05/2012 07:48 AM, Andrew Jaimes wrote:
>
> > ' -> Hash Join (cost=10.93..99795.09 rows=242803 width=0) (actual
> > time=0.541..2249.027 rows=33 loops=1)'
> > ' Hash Cond: ((a_activity.activequeueid = l_userqueue.queueid)
> > AND (a_activity.sbuid = e_usersessions.sbuid))'
> > ' -> Seq Scan on a_activity (cost=0.00..88462.52 rows=1208167
> > width=22) (actual time=0.010..1662.142
>
> I'd be willing to bet your stats are way, way off. It expected 242,803
> rows in the hash, but only got 33. In that kind of scenario, I could
> easily see the planner choosing a sequence scan over an index scan, as
> doing that many index seeks would be much more expensive than scanning
> the table.
>
> What's your default_statistics_target, and when is the last time you
> analyzed the tables in this query?
>
> --
> 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
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance

pgsql-performance by date:

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