Re: multivariate statistics (v19)
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2017-02-04T00:03:05Z
Lists: pgsql-hackers
On Thu, Feb 2, 2017 at 3:59 AM, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote: > There's a subtle difference between pg_node_tree and the data types for > statistics - pg_node_tree stores the value as a string (matching the > nodeToString output), so the _in function is fairly simple. Of course, > stringToNode() assumes safe input, which is why the input is disabled. > > OTOH the statistics are stored in an optimized binary format, allowing to > use the value directly (without having to do expensive parsing etc). > > I was thinking that the easiest way to add support for _in would be to add a > bunch of Nodes for the statistics, along with in/out functions, but keeping > the internal binary representation. But that'll be tricky to do in a safe > way - even if those nodes are coded in a very defensive ways, I'd bet > there'll be ways to inject unsafe nodes. > > So I'm OK with not having the _in for now. If needed, it's possible to > construct the statistics as a bytea using a bit of C code. That's at least > obviously unsafe, as anything written in C, touching the memory. Since these data types are already special-purpose, I don't really see why it would be desirable to entangle them with the existing code for serializing and deserializing Nodes. Whether or not it's absolutely necessary for these types to have input functions, it seems at least possible that it would be useful, and it becomes much less likely that we can make that work if it's piggybacking on stringToNode(). -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Collect and use multi-column dependency stats
- 2686ee1b7ccf 10.0 landed
-
Implement SortSupport for macaddr data type
- f90d23d0c518 10.0 cited
-
Implement multivariate n-distinct coefficients
- 7b504eb282ca 10.0 landed
-
Generate fmgr prototypes automatically
- 352a24a1f9d6 10.0 cited