Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/6118~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/6118
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on Oct 14, 2025

  1. Preserve index stats during ALTER TABLE ... TYPE ...

    During ALTER TABLE ... TYPE ... on an indexed column, a new index is created and
    the old one is dropped. Currently this causes the statistics such as idx_scan,
    last_idx_scan, and related counters to be lost.
    
    We can not use pgstat_copy_relation_stats() because the old index is dropped
    before the new one is created, so this commit saves the old PgStat_StatTabEntry
    and restores it in the new index. This is done by adding a pointer to a hash table
    in AlteredTableInfo where the hash key is the partition table Oid. This hash table
    stores a list of all the information needed to restore the stats in the right
    index.
    
    The stats are saved in ATPostAlterTypeParse() (before the old index is dropped)
    and restored in ATExecAddIndex() once the new index is created.
    
    Note that pending statistics (if any) are not preserved, only the
    accumulated stats from previous transactions. This is acceptable since the
    accumulated stats represent the historical usage patterns we want to maintain.
    bdrouvotAWS authored and Commitfest Bot committed Oct 14, 2025
    Configuration menu
    Copy the full SHA
    54a462d View commit details
    Browse the repository at this point in the history
  2. [CF 6118] v2 - Preserve index stats during ALTER TABLE ... TYPE ...

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/6118
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/[email protected]
    Author(s): Bertrand Drouvot
    Commitfest Bot committed Oct 14, 2025
    Configuration menu
    Copy the full SHA
    76020a9 View commit details
    Browse the repository at this point in the history
Loading