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

Re: Premature view materialization in 8.2?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jonathan Ellis" <jonathan(at)utahpython(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Premature view materialization in 8.2?
Date: 2007-04-06 18:34:48
Message-ID: 15902.1175884488@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
"Jonathan Ellis" <jonathan(at)utahpython(dot)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

In response to

Responses

pgsql-performance by date

Next:From: RonDate: 2007-04-06 19:37:08
Subject: Re: SCSI vs SATA
Previous:From: Michael StoneDate: 2007-04-06 18:19:15
Subject: Re: SCSI vs SATA

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