Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Greg Stark
Dave Smith <[EMAIL PROTECTED]> writes: > That's what I wanted it to do I just did not understand how to read the > explain. So is it HashAggregate that means this already loaded? The HashAggregate Node is doing a GROUP BY command. (or the implicit GROUP BY if you used an aggregate function witho

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Dave Smith
That's what I wanted it to do I just did not understand how to read the explain. So is it HashAggregate that means this already loaded? On Thu, 2004-11-25 at 12:57, Tom Lane wrote: > Dave Smith <[EMAIL PROTECTED]> writes: > > Well here is explain. I would guess that it is executed each time .. > >

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Tom Lane
Dave Smith <[EMAIL PROTECTED]> writes: > Well here is explain. I would guess that it is executed each time .. > function any different? > HashAggregate (cost=288.32..288.32 rows=1 width=32) >-> Hash IN Join (cost=288.18..288.31 rows=1 width=32) > -> Subquery Scan journal_all (cos

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Martijn van Oosterhout
Running EXPLAIN over the query will tell you... On Thu, Nov 25, 2004 at 11:49:06AM -0500, Dave Smith wrote: > I have a query with an in subquery like > > where x in (select x from y); > > Now the subquery is not related to the outer query so it always returns > the same set. Is this subselect ex

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Dave Smith
Well here is explain. I would guess that it is executed each time .. function any different? HashAggregate (cost=288.32..288.32 rows=1 width=32) -> Hash IN Join (cost=288.18..288.31 rows=1 width=32) Hash Cond: (("outer".gl_num)::text = lpad(ltrim(("inner".account_num)::text, '0'::te

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Martijn van Oosterhout
On Thu, Nov 25, 2004 at 12:19:23PM -0500, Dave Smith wrote: > Well here is explain. I would guess that it is executed each time .. > function any different? Hmm, if it's only executed once I would expect it to be an InitPlan. Are you sure it's not correlated? If you want to make sure, put the sub

[GENERAL] Using IN with subselect

2004-11-25 Thread Dave Smith
I have a query with an in subquery like where x in (select x from y); Now the subquery is not related to the outer query so it always returns the same set. Is this subselect executed each time or just once? If it is executed each time, if I create a function would that then be only executed once?