1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Take pg_attribute out of VacAttrStats

The VacAttrStats structure contained the whole Form_pg_attribute for a
column, but it actually only needs attstattarget from there.  So
remove the Form_pg_attribute field and make a separate field for
attstattarget.  This simplifies some code for extended statistics that
doesn't deal with a column but an expression, which had to fake up
pg_attribute rows to satisfy internal APIs.  Also, we can remove some
comments that essentially said "don't look at pg_attribute directly".

Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/d6069765-5971-04d3-c10d-e4f7b2e9c459%40eisentraut.org
This commit is contained in:
Peter Eisentraut
2023-07-03 07:09:22 +02:00
parent 7a7f60aef8
commit c69bdf837f
6 changed files with 43 additions and 80 deletions

View File

@@ -263,7 +263,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
* the number of individual elements tracked in pg_statistic ought to be
* more than the number of values for a simple scalar column.
*/
num_mcelem = stats->attr->attstattarget * 10;
num_mcelem = stats->attstattarget * 10;
/*
* We set bucket width equal to num_mcelem / 0.007 as per the comment
@@ -575,7 +575,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
count_items_count = hash_get_num_entries(count_tab);
if (count_items_count > 0)
{
int num_hist = stats->attr->attstattarget;
int num_hist = stats->attstattarget;
DECountItem **sorted_count_items;
int j;
int delta;