Re: [PERFORM] Sequencial scan in a JOIN

2012-07-18 Thread Robert Haas
On Tue, Jun 5, 2012 at 8:48 AM, Andrew Jaimes wrote: > Hi everyone, > > I am trying to run the following query: > > SELECT count(1) --DISTINCT l_userqueue.queueid > FROM e_usersessions > JOIN l_userqueue > ON l_userqueue.userid = e_usersessions.entityid > JOIN a_activity > ON a_acti

Re: [PERFORM] Sequencial scan in a JOIN

2012-06-05 Thread Shaun Thomas
On 06/05/2012 09:41 AM, Andrew Jaimes wrote: The second query ran better than the first one: That's what I figured. Ok, so looking back to your original message again: CREATE INDEX i08_a_activity ON a_activity USING btree (activequeueid , vstatus , ventrydate ); Based on the query here

Re: [PERFORM] Sequencial scan in a JOIN

2012-06-05 Thread Shaun Thomas
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 O

Re: [PERFORM] Sequencial scan in a JOIN

2012-06-05 Thread Andrew Jaimes
gt; 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 Con

Re: [PERFORM] Sequencial scan in a JOIN

2012-06-05 Thread Shaun Thomas
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