pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jonathan Ellis <jonathan@utahpython.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Premature view materialization in 8.2?
Date: Fri, 06 Apr 2007 14:34:48 -0400
Message-ID: <15902.1175884488@sss.pgh.pa.us> (raw)
In-Reply-To: <e06563880704061103w10e19b96s4223527ebce6b33b@mail.gmail.com>
References: <e06563880704051146r357cb15by7e498c6d796b093a@mail.gmail.com>
	<28349.1175838196@sss.pgh.pa.us>
	<e06563880704052251j68c86dafx5ba5a8f10fb28268@mail.gmail.com>
	<261.1175840636@sss.pgh.pa.us>
	<e06563880704060724n17a1de97j5d64fafc1ea95b21@mail.gmail.com>
	<15092.1175881227@sss.pgh.pa.us>
	<e06563880704061057q46db0f90w5128ce74471b53ad@mail.gmail.com>
	<15399.1175882434@sss.pgh.pa.us>
	<e06563880704061103w10e19b96s4223527ebce6b33b@mail.gmail.com>

"Jonathan Ellis" <jonathan@utahpython.org> writes:
> It was in my original post unless it got clipped:

Sorry, I had forgotten.

> The problem seems to be that clan_members_v contains a call to an
> expensive function:

I'll bet that the function is marked VOLATILE.  8.2 is more conservative
about optimizing away volatile functions than previous releases.  If
it has no side effects, mark it STABLE (or can it even be IMMUTABLE?).

In some quick testing, I verified that 8.2 does evaluate the function at
the join level corresponding to the view's join (and I think this is
preventing it from considering other join orders, too).  If you change
the function's marking to be nonvolatile then the function disappears
from the plan entirely, and also it seems to prefer joining "clans" sooner.

			regards, tom lane



view thread (11+ messages)  latest in thread

Message-ID: <15902.1175884488@sss.pgh.pa.us>
Permalink:  ../15902.1175884488@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15902.1175884488@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, jonathan@utahpython.org
  Subject: Re: Premature view materialization in 8.2?
  In-Reply-To: <15902.1175884488@sss.pgh.pa.us>

* 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