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/5805~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/5805
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Aug 30, 2025

  1. Track the maximum possible frequency of non-MCE array elements.

    The lossy-counting algorithm that ANALYZE uses to identify
    most-common array elements may decide that none of the values
    are common enough to be called MCEs.  In such cases we stored
    nothing in the STATISTIC_KIND_MCELEM pg_statistic slot, which
    resulted in array_selfuncs.c falling back to default estimates.
    However, we do in fact have valuable information to convey:
    we know that none of the array elements are as common as the
    cutoff frequency that lossy counting reported.  If we report
    that as the minimum MCE frequency, array_selfuncs.c will
    arrive at significantly-better-than-default estimates.
    
    So we want to construct a STATISTIC_KIND_MCELEM entry that contains
    no "values" but does have "numbers", to wit the three extra numbers
    that the MCELEM entry type defines.  A small obstacle is that
    update_attstats() has traditionally stored a null, not an empty array,
    when passed zero "values" for a slot.  That gives rise to an MCELEM
    entry that get_attstatsslot() will spit up on.  The least risky
    solution seems to be to adjust update_attstats() so that it will emit
    a non-null (but possibly empty) array when the passed stavalues array
    pointer isn't NULL, rather than conditioning that on numvalues > 0.
    In other existing cases I don't believe that that changes anything.
    For consistency, handle the stanumbers array the same way.
    
    Reported-by: Mark Frost <[email protected]>
    Author: Tom Lane <[email protected]>
    Discussion: https://postgr.es/m/PH3PPF1C905D6E6F24A5C1A1A1D8345B593E16FA@PH3PPF1C905D6E6.namprd15.prod.outlook.com
    tglsfdc authored and Commitfest Bot committed Aug 30, 2025
    Configuration menu
    Copy the full SHA
    77461f7 View commit details
    Browse the repository at this point in the history
  2. [CF 5805] v1 - Improve array-element-test estimation when no array el…

    …ements qualify as common
    
    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5805
    
    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): Tom Lane
    Commitfest Bot committed Aug 30, 2025
    Configuration menu
    Copy the full SHA
    5c91f54 View commit details
    Browse the repository at this point in the history
Loading