Idea for speeding up uncorrelated subqueries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vadim Mikheev <vadim(at)krs(dot)ru>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Idea for speeding up uncorrelated subqueries
Date: 1999-08-05 14:52:00
Message-ID: 4244.933864720@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Someone was just complaining over in the sql list about the poor
performance of

select name,description from descriptions
where name in (select name
from descriptions
where description like '%Bankverbindung%');

Since the inner query is uncorrelated with the outer, there's really
no need to execute it more than once, but currently it's re-executed
each time through the outer plan.

I wonder whether it wouldn't be a good idea to force a Materialize
node to be added to the top of an uncorrelated subplan? Then at
least the re-executions would be pretty cheap...

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 1999-08-05 14:53:15 New man pages
Previous Message Thomas Lockhart 1999-08-05 14:39:29 Re: [HACKERS] parse_coerce question