Thread: Re: [HACKERS] extended stats not friendly towards ANALYZE withsubset of columns

Re: [HACKERS] extended stats not friendly towards ANALYZE withsubset of columns

From
Alvaro Herrera
Date:
David Rowley wrote:

> ERROR:  extended statistics could not be collected for column "a" of
> relation public.ab1
> HINT:  Consider ALTER TABLE "public"."ab1" ALTER "a" SET STATISTICS -1
> 
> I don't think the error is useful here, as it means nothing gets done.
> Probably better to just not (re)build those stats.

Agreed, an error there is a bad idea.

> Another option would be to check for extended stats before deciding
> which rows to ANALYZE, then still gathering the columns required for
> MV stats, but I think if the user asks for a subset of columns to be
> analyzed, and that causes a column to be missing for an extended
> statistics, that it would be pretty surprising if we rebuild the
> extended stats.

That would be very surprising indeed.

> Perhaps the SET STATISTIC 0 for a column still needs to gather data
> for extended statistics, though. Perhaps a debate should ensue about
> how that should work exactly.

Hmm.  I'd rather throw a warning at either CREATE STATISTICS time or at
ALTER TABLE SET STATISTICS time, rather than magically changing the set
of columns at analyze time.

> I've attached a patch which fixes the problem above, but it does
> nothing to change the analyze behaviour for 0 statistics columns.

Pushed, after tweaking so that a WARNING is still emitted, because it's
likely to be useful in pointing out a procedural mistake while extended
stats are being tested.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



On 18 April 2017 at 05:12, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> Pushed, after tweaking so that a WARNING is still emitted, because it's
> likely to be useful in pointing out a procedural mistake while extended
> stats are being tested.

Thanks for pushing.

Seems you maintained most of my original patch and added to it a bit,
but credits don't seem to reflect that. It's not the end of the world
but just wanted to note that.


-- David Rowley                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



Re: [HACKERS] extended stats not friendly towards ANALYZE withsubset of columns

From
Alvaro Herrera
Date:
David Rowley wrote:
> On 18 April 2017 at 05:12, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> > Pushed, after tweaking so that a WARNING is still emitted, because it's
> > likely to be useful in pointing out a procedural mistake while extended
> > stats are being tested.
> 
> Thanks for pushing.
> 
> Seems you maintained most of my original patch and added to it a bit,
> but credits don't seem to reflect that. It's not the end of the world
> but just wanted to note that.

Yeah, sorry about that.  Maybe we should start mentioning the percentage
of the patch that comes from each author (just kidding).

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services