Re: rules: evaluate inputs in advance - Mailing list pgsql-general

From Markus Schiltknecht
Subject Re: rules: evaluate inputs in advance
Date
Msg-id 1147586499.4851.8.camel@localhost.localdomain
Whole thread Raw
In response to Re: rules: evaluate inputs in advance  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: rules: evaluate inputs in advance  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Hi Martijn,

On Fri, 2006-05-12 at 18:05 +0200, Martijn van Oosterhout wrote:
> But it can't really. In the example that started this thread, there are
> two seperate rules and after rewriting the executor will be presented
> two seperate queries.

Ah, thank you, that explains the difficulties with rules.

> What you probably want is a function that is given the row and then
> executes the two statements on a per row basis. This has the effect you
> want but gives up the major benefit of rules, wholesale query
> restructuring like views which allows the executor to find better
> plans. The executor can't see inside a trigger so it can't optimise.

Isn't that an argument for keeping rewrite rules instead of using
something trigger like for updatable views? Wouldn't it be feasible to
teach the executor how to handle multiple queries with some
pre-evaluated input?

Regards

Markus



pgsql-general by date:

Previous
From: "Ed L."
Date:
Subject: pg_dump index/constraint creation order
Next
From: Lincoln Yeoh
Date:
Subject: Re: [PERFORM] Arguments Pro/Contra Software Raid