pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Wieck <wieck@debis.com>
To: Rick Delaney <rick@consumercontact.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Calculation dependencies in views
Date: Thu, 06 Jan 2000 01:10:22 +0100
Message-ID: <3873DD6E.BBBF5813@debis.com> (raw)
References: <38728CE2.C1756D3E@consumercontact.com>
	<3872987B.C289AB59@debis.com>
	<3873A662.37B94F7E@consumercontact.com>
	<3873BC4C.3D4E4BCC@debis.com>
	<3873D036.5A2A9B18@consumercontact.com>

Rick Delaney wrote:

> Jan Wieck wrote:
> >
> >      As the author of "The Postgres Rule System" I say yes, except that it
>                                                    ^^^^^^^^^
> >      requires some recursions in the rewriter. Thus, it will take a little
>
> Sorry to be stupid but with my terribly phrased question I can't tell if you mean
> "Yes, you are correct that you will still get 'rule plan string too big' errors
> with nested views" or "Yes, nested views will work fine as I described despite
> your erroneous interpretation of what you read (but you may have to fix the
> recursion limit as I already said)".  :-)
>
> I'm 99% sure you mean the latter, now, after re-reading "The Postgres Rule
> System" and your first reply to me.  I guess the only reason I'm not 100% sure is
> I don't understand where the 'rule plan string too big' limit comes from.  Is it
> in the storage of the view/rule (related to the 8K limit on row size)?  I guess
> that would make sense.

     Stop (rereading) recursion now - you got it.

     It's exactly the storage of rules (views are implemented via rewriting
     rules) in combo with the 8K limit, that causes this "rule plan string too
     big" error. Just the the view/rule creation utility does some extra check
     for it.

     Rules are stored as a special kind of printable querytree string. A
     querytree is the systems internal representation of a query, and they are
     really verbose and thus - well - huge (compared to what the user typed in).

     Example 1:


          CREATE VIEW v1 AS
              SELECT a, a + b AS ab, a + b + c AS abc FROM t1;

     Example 2:


          CREATE VIEW v1_sub AS
              SELECT a, c, a + b AS ab FROM t1;
          CREATE VIEW v1 AS
              SELECT a, ab, ab + c AS abc FROM v1_sub;

     These two examples will result in exactly the same querytree after
     rewriting, if you SELECT from v1. The second needs two passes in the
     rewriter, but that's the only difference.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #






view thread (10+ messages)  latest in thread

Message-ID: <3873DD6E.BBBF5813@debis.com>
Permalink:  ../3873DD6E.BBBF5813@debis.com/
Also on:    postgresql.org/message-id/3873DD6E.BBBF5813@debis.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: wieck@debis.com, rick@consumercontact.com
  Subject: Re: [SQL] Calculation dependencies in views
  In-Reply-To: <3873DD6E.BBBF5813@debis.com>
  References: <38728CE2.C1756D3E@consumercontact.com> <3872987B.C289AB59@debis.com> <3873A662.37B94F7E@consumercontact.com> <3873BC4C.3D4E4BCC@debis.com> <3873D036.5A2A9B18@consumercontact.com> <3873DD6E.BBBF5813@debis.com>

* 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