Re: Statistics Import and Export - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Statistics Import and Export
Date
Msg-id 26e55538fa8c47d660642f367cd8a19333420789.camel@j-davis.com
Whole thread Raw
In response to Statistics Import and Export  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: Statistics Import and Export
List pgsql-hackers
On Tue, 2025-02-11 at 14:02 -0500, Corey Huinker wrote:
>
>
> The previous 0001 is now committed (thanks!) so only one remains.
>  

Summary of the decisions made in this thread:

  * pg_dump --data-only does not include stats[1]. This behavior was
    not fully resolved, but I didn't see a reasonable set of options
    where (a) --data-only would include stats; and (b) we could
    specify what pg_upgrade needs, which is schema+stats. Jian seemed
    to agree. However, this leaves us with the behavior where
    --data-only doesn't get everything in SECTION_DATA, which might be
    undesirable.
  * stats are in SECTION_DATA[2], except for stats on objects that
    are created in SECTION_POST_DATA, in which case the stats are
    also in SECTION_POST_DATA
    - indexes are created in SECTION_POST_DATA, and though plain
      indexes don't have stats, expression indexes do
    - MVs are normally created in SECTION_PRE_DATA, in which case
      the stats are in SECTION_DATA; but MVs can be deferred to
      SECTION_POST_DATA due to dependency on a primary key
  * SECTION_NONE was proposed, but rejected[2]
  * The default is to include the stats.[3]
  * pg_dump[all] options are designed to allow specifying any
    combination of schema[4], data, and stats:
      --schema-only (schema), --no-schema (data+stats)
      --data-only (data), --no-data (schema+stats)
      --stats-only (stats), --no-stats (schema+data)
  * A SECTION_STATS was proposed and rejected due to complexity[5]
  * The prefix in the dump output will be "Statistics for " (instead
    of "Data for ")[6]
  * The TOC description will be "STATISTICS DATA", differentiating
    it from an extended statistics object[6]
  * pg_upgrade will now pass --no-data (schema+stats) to pg_dump
    instead of --schema-only, thereby transferring the stats to the
    new cluster[7]

It's been a long thread, so please tell me if I missed something or if
something needs more discussion.

I'm still reviewing v48, but I intend to commit something soon.

Regards,
    Jeff Davis

[1]
https://www.postgresql.org/message-id/b40b81d38c3a87fdef61e4f7abfbc7f27c7fbcd9.camel@j-davis.com

[2]
https://www.postgresql.org/message-id/1798867.1712376328%40sss.pgh.pa.us

[3]
https://www.postgresql.org/message-id/3228677.1713844341%40sss.pgh.pa.us

[4]
https://www.postgresql.org/message-id/CACJufxG6K4EAUROhdr0wkzMh5QyFLmdLZeAoh7Vh0-VbuAtHcw%40mail.gmail.com

[5]
https://www.postgresql.org/message-id/3156140.1713817153%40sss.pgh.pa.us

[6]
https://www.postgresql.org/message-id/d8df5339cab25b5720667beaaed8a8bb8e11578c.camel@j-davis.com

[7]
https://www.postgresql.org/message-id/c2bc08dfec336c03f7a7165d1347e2b52cf98b17.camel@j-davis.com





pgsql-hackers by date:

Previous
From: "Anton A. Melnikov"
Date:
Subject: Re: Change GUC hashtable to use simplehash?
Next
From: Thomas Munro
Date:
Subject: Re: BitmapHeapScan streaming read user and prelim refactoring