Re: multivariate statistics (v19)
Petr Jelinek <petr.jelinek@2ndquadrant.com>
From: Petr Jelinek <petr.jelinek@2ndquadrant.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>,
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>,
Dean Rasheed <dean.a.rasheed@gmail.com>, Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Michael Paquier <michael.paquier@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Tatsuo Ishii <ishii@postgresql.org>, David Steele <david@pgmasters.net>, Tom Lane <tgl@sss.pgh.pa.us>, Álvaro Herrera <alvherre@2ndquadrant.com>, Petr Jelinek <petr@2ndquadrant.com>, Jeff Janes <jeff.janes@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2016-12-30T13:05:18Z
Lists: pgsql-hackers
On 12/12/16 22:50, Tomas Vondra wrote: >> +<programlisting> >> +SELECT pg_mv_stats_dependencies_show(stadeps) >> + FROM pg_mv_statistic WHERE staname = 's1'; >> + >> + pg_mv_stats_dependencies_show >> +------------------------------- >> + (1) => 2, (2) => 1 >> +(1 row) >> +</programlisting> >> >> Couldn't this somehow show actual column names, instead of attribute >> numbers? >> > > Yeah, I was thinking about that too. The trouble is that's table-level > metadata, so we don't have that kind of info serialized within the data > type (e.g. because it would not handle column renames etc.). > > It might be possible to explicitly pass the table OID as a parameter of > the function, but it seemed a bit ugly to me. I think it makes sense to have such function, this is not out function so I think it's ok for it to have the oid as input, especially since in the use-case shown above you can use starelid easily. > > FWIW, as I wrote in this thread, the place where this patch series needs > feedback most desperately is integration into the optimizer. Currently > all the magic happens in clausesel.c and does not leave it.I think it > would be good to move some of that (particularly the choice of > statistics to apply) to an earlier stage, and store the information > within the plan tree itself, so that it's available outside clausesel.c > (e.g. for EXPLAIN - showing which stats were picked seems useful). > > I was thinking it might work similarly to the foreign key estimation > patch (100340e2). It might even be more efficient, as the current code > may end repeating the selection of statistics multiple times. But > enriching the plan tree turned out to be way more invasive than I'm > comfortable with (but maybe that'd be OK). > In theory it seems like possibly reasonable approach to me, mainly because mv statistics are user defined objects. I guess we'd have to see at least some PoC to see how invasive it is. But I ultimately think that feedback from a committer who is more familiar with planner is needed here. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
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