mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Use column collation for extended statistics
The current extended statistics code was a bit confused which collation to use. When building the statistics, the collations defined as default for the data types were used (since commit5e0928005). The MCV code was however using the column collations for MCV serialization, and then DEFAULT_COLLATION_OID when computing estimates. So overall the code was using all three possible options, inconsistently. This uses the column colation everywhere - this makes it consistent with what5e0928005did for regular stats. We however do not track the collations in a catalog, because we can derive them from column-level information. This may need to change in the future, e.g. after allowing statistics on expressions. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu Backpatch-to: 12
This commit is contained in:
@@ -477,7 +477,7 @@ ndistinct_for_combination(double totalrows, int numrows, HeapTuple *rows,
|
||||
colstat->attrtypid);
|
||||
|
||||
/* prepare the sort function for this dimension */
|
||||
multi_sort_add_dimension(mss, i, type->lt_opr, type->typcollation);
|
||||
multi_sort_add_dimension(mss, i, type->lt_opr, colstat->attrcollid);
|
||||
|
||||
/* accumulate all the data for this dimension into the arrays */
|
||||
for (j = 0; j < numrows; j++)
|
||||
|
||||
Reference in New Issue
Block a user