Re: [HACKERS] Subqueries and indexes - Mailing list pgsql-hackers

From Vadim Mikheev
Subject Re: [HACKERS] Subqueries and indexes
Date
Msg-id 36EF54B8.D1B6F7C5@krs.ru
Whole thread Raw
In response to Re: [HACKERS] Subqueries and indexes  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [HACKERS] Subqueries and indexes
List pgsql-hackers
Bruce Momjian wrote:
> 
> > >
> > > Seems the optimizer could either hash the subquery, or us an index.
> > > Certainly would be faster than a sequental scan, no?
> >
> > Optimizer should hash the subquery, but I didn't implement this -:(
> > Try to rewrite query using NOT EXISTS and index will be used.
> 
> How hard would it be to implement it?  I know you are deep into MVCC,
> but doing a nested loop to join a subquery is really bad.

Not very hard, for un-correlated subqueries at least.
I have no time to do this for 6.5...

> 
...
> 
> All queries can't be rewritten as EXISTS.

All except of subqueries with aggregates in target list.

Vadim


pgsql-hackers by date:

Previous
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] Sequences....
Next
From: Zeugswetter Andreas IZ5
Date:
Subject: Re: [HACKERS] Associative Operators? (Was: Re: [NOVICE] Out of f rying pan, into fire)