Re: 8.1 vs 8.2.1 view optimization

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Nathan Bell <nathanb(at)actarg(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: 8.1 vs 8.2.1 view optimization
Date: 2007-01-16 22:04:55
Message-ID: 20070116220455.GL8182@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 16, 2007 at 02:55:08PM -0700, Nathan Bell wrote:
> Yeah, I saw the "not optimized out" typo as soon as I hit send.
>
> What if the item that is taking a long time isn't a function, but rather
> a sub-select?

The planner should be able to see that the item is non-volatile itself.
It only needs to be told for functions because it can't see into them.

> Can I set the sub-select to stable, or perhaps set the entire view to
> non-volatile to achieve the same result?

No.

> If not, can I set the sub-select to a different non-volatile view or do
> I need to create a non-volatile function that returns the result?

You could create a function that does the job, but that's generally not
necessary.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Earl 2007-01-16 22:47:09 GUID/UUID Support
Previous Message Tom Lane 2007-01-16 22:03:12 Re: 8.1 vs 8.2.1 view optimization