| 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 |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ron | 2007-04-06 19:37:08 | Re: SCSI vs SATA |
| Previous Message | Michael Stone | 2007-04-06 18:19:15 | Re: SCSI vs SATA |