Skip site navigation (1) Skip section navigation (2)

Re: Repeated execution of identical subqueries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Repeated execution of identical subqueries
Date: 2008-03-13 05:13:24
Message-ID: 7556.1205385204@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> writes:
> Is there any way to get postgresql to detect such repeated query parts 
> and evaluate them only once?

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.

There is work afoot to implement the SQL:2003 "WITH" syntax, which
I think would offer a syntactic solution to your problem.

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Scott MarloweDate: 2008-03-13 05:31:51
Subject: Re: Benchmark: Dell/Perc 6, 8 disk RAID 10
Previous:From: Craig JamesDate: 2008-03-13 04:55:18
Subject: Benchmark: Dell/Perc 6, 8 disk RAID 10

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group