Re: [HACKERS] LZTEXT for rule plan stings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] LZTEXT for rule plan stings
Date
Msg-id 27312.951585319@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] LZTEXT for rule plan stings  (Don Baccus <dhogaza@pacifier.com>)
Responses Re: [HACKERS] LZTEXT for rule plan stings
List pgsql-hackers
Don Baccus <dhogaza@pacifier.com> writes:
>> What's your basis for asserting the rule is only ~ 1K?

> I looked at the string dumped by pg_dump and it didn't appear to be
> anywhere near 8KB, so I presumed that the actual data stuffed into
> the rule is larger than whatever gets dumped out as the source
> representation.

Yes, the source representation is *vastly* more compact.  A single
result column might look like "tab1.product_id" when dumped by pg_dump,
but the nodetree dump looks more like
     { TARGETENTRY      :resdom         { RESDOM         :resno 1         :restype 23         :restypmod -1
:resnameproduct_id         :reskey 0         :reskeyop 0         :ressortgroupref 0         :resjunk false         }
      :expr         { VAR         :varno 1         :varattno 1         :vartype 23         :vartypmod -1
:varlevelsup0         :varnoold 1         :varoattno 1        }     }
 

and (except for not using any excess whitespace) that is exactly what
goes into a rule action string.

As you can see, this is very amenable to compression, especially
when you have a lot of columns in a view.

Someday we might think about using a more compact representation for
stored rules, but there are advantages to using a format that's fairly
easy for a human to examine.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] LZTEXT for rule plan stings
Next
From: Don Baccus
Date:
Subject: Re: [HACKERS] LZTEXT for rule plan stings