From: Craig Ringer <craig@postnewspapers.com.au>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Repeated execution of identical subqueries
Date: Thu, 13 Mar 2008 15:35:00 +0900
Message-ID: <47D8CB14.8020400@postnewspapers.com.au> (raw)
In-Reply-To: <7556.1205385204@sss.pgh.pa.us>
References: <47D8A191.6000303@postnewspapers.com.au>
<7556.1205385204@sss.pgh.pa.us>
Tom Lane wrote:
> No, not at the moment. In principle the planner could look for such
> duplicates, but it'd be wasted cycles so much of the time that I'd be
> loath to do it.
>
Good point - there are better places to spend time, and I imagine it'd
be an expensive thing to check too.
> There is work afoot to implement the SQL:2003 "WITH" syntax, which
> I think would offer a syntactic solution to your problem.
Yes, it would. In fact, I was thinking about the syntax seen in some
functional languages - like Haskell's `where' clause - that defines a
subexpression available to all parts of the expression. If the SQL:2003
WITH expression is anything like that it'd be very handy indeed.
--
Craig Ringer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: craig@postnewspapers.com.au, tgl@sss.pgh.pa.us
Subject: Re: Repeated execution of identical subqueries
In-Reply-To: <47D8CB14.8020400@postnewspapers.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox