Re: [SQL] uncorrelated subqueries

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Lowery <bruce(dot)lowery(at)edventions(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] uncorrelated subqueries
Date: 1999-07-11 14:37:03
Message-ID: l03130305b3ae5b9cac2f@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 22:30 +0300 on 08/07/1999, Tom Lane wrote:

> The main problem that would have to be solved to convert this to
> an InitPlan is what to do if the subselect returns a huge number
> of tuples ... with the current implementation, since we scan the
> tuples one at a time, there's no problem, but if we try to store
> all the tuples we could run out of memory.

How about putting them in a temporary table if the number of returned
tuples is big? Although the scan on the temp table will be sequential, it's
still not the same as scanning the original table (checking conditions and
perhaps even joining). If the internal query is ran on a 3 million record
table, and returns a million of them, it's worthwhile storing in a temp
table.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Herouth Maoz 1999-07-11 14:57:33 Re: [SQL] Bad date representation
Previous Message Oleg Bartunov 1999-07-11 06:09:24 Re: [SQL] Re: [HACKERS] SELECT DISTINCT question