diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2025-02-19 11:56:54 +0200 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2025-02-19 11:59:30 +0200 |
commit | e983ee9380fcac746f9b6b7c360d255d9fcd0907 (patch) | |
tree | b72ebe7a154d626c2bea1c6db153dc55d7567ff1 /src/include | |
parent | 8a695d7998be67445b9cd8e67faa684d4e87a40d (diff) |
Improve statistics estimation for single-column GROUP BY in sub-queries
This commit follows the idea of the 4767bc8ff2. If sub-query has only one
GROUP BY column, we can consider its output variable as being unique. We can
employ this fact in the statistics to make more precise estimations in the
upper query block.
Author: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/utils/selfuncs.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h index b5e95c0ff61..d35939651f3 100644 --- a/src/include/utils/selfuncs.h +++ b/src/include/utils/selfuncs.h @@ -94,7 +94,8 @@ typedef struct VariableStatData Oid vartype; /* exposed type of expression */ Oid atttype; /* actual type (after stripping relabel) */ int32 atttypmod; /* actual typmod (after stripping relabel) */ - bool isunique; /* matches unique index or DISTINCT clause */ + bool isunique; /* matches unique index, DISTINCT or GROUP-BY + * clause */ bool acl_ok; /* result of ACL check on table or column */ } VariableStatData; |