Re: Bogosities in pg_dump's extended statistics support

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: Bogosities in pg_dump's extended statistics support
Date: 2018-02-12 16:25:49
Message-ID: CA+TgmoZdQkD2Fb3zxUotmusdXm=Rdqb-AM+=Akw1Q-5qJLmQQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 12, 2018 at 10:07 AM, Alvaro Herrera
<alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> The followup question is what to do for multi-table stats objects. I
> think the options are that it should be dumped if:
>
> 1. any of its tables are dumped
> 2. *all* its tables are dumped
> 3. the schema containing the stats object is dumped
>
> I think #2 is a loser: the object goes missing if you dump the tables
> individually.
>
> #3 has a similar problem: if you put the stats object in a schema that's
> not that of any of the involved tables (admittedly a somewhat odd
> choice), then again the stats object goes missing, and there is no
> indication that the dump is incomplete except that the application
> becomes slower -- a situation difficult to detect (unlike missing
> regular objects, because then queries break in obvious ways).
>
> My preference is for #1. It has the small problem that if you have one
> dump for each table, the stats object appears more than once (so
> restoring both causes an error during restore of the second one), but I
> don't think this is terrible.

It's not the worst thing in the world, but it's a long way from being
the best thing. My personal experience has been that it sucks when
you get errors during a restore -- it's often not clear exactly what
object was affected and whether the error is something that's going to
break your application. Of course, it's even worse if you are
restoring in single-transaction or on-error-stop mode.

I believe I previously argued that statistics objects should be
considered first-class objects in their own right, not just table
properties, and that's still my position. In short, I agree with Tom.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2018-02-12 16:30:57 Re: A space-efficient, user-friendly way to store categorical data
Previous Message Andres Freund 2018-02-12 16:20:40 Re: [HACKERS] logical decoding of two-phase transactions