Re: multivariate statistics / patch v7

Tomas Vondra <tomas.vondra@2ndquadrant.com>

From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Jeff Janes <jeff.janes@gmail.com>, Stephen Frost <sfrost@snowman.net>, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Date: 2015-05-25T20:43:46Z
Lists: pgsql-hackers

Attachments

Hello,

attached is v7 of the multivariate stats patch. The main improvement is 
major refactoring of the clausesel.c portion - splitting the awfully 
long spaghetti-style functions into smaller pieces, making it much more 
understandable etc.

I do assume some of those pieces are unnecessary because there already 
is a helper function with the same purpose (but I'm not aware of that). 
But IMHO this piece of code begins to look reasonable (especially when 
compared to the previous state).

The other major improvement it review of the comments (including FIXMEs 
and TODOs), and removal of the obsolete / misplaced ones. And there was 
plenty of those ...

These changes made this version ~20k smaller than v6.

The patch also rebases to current master, which I assume shall be quite 
stable - so hopefully no more duplicate OIDs for a while.

There are 6 files attached, but only 0002-0006 are actually part of the 
multivariate statistics patch itself. The first part makes it possible 
to use pull_varnos() with expression trees containing RestrictInfo 
nodes, but maybe this is not the right way to fix this (there's another 
thread where this was discussed).

Also, the regression tests testing plan choice with multivariate stats 
(e.g. that a bitmap index scan is chosen instead of index scan) fail 
from time to time. I suppose this happens because the invalidation after 
ANALYZE is not processed before executing the query, so the optimizer 
does not see the stats, or something like that.


regards

--
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Commits

  1. Collect and use multi-column dependency stats

  2. Implement SortSupport for macaddr data type

  3. Implement multivariate n-distinct coefficients

  4. Generate fmgr prototypes automatically