aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/lockfuncs.c
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2023-01-08 22:34:59 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2023-01-08 22:51:43 +0300
commitcd9479af2af25d7fa9bfd24dd4dcf976b360f077 (patch)
tree6907c13950f19dd650a646ddd9fcee7f436309f7 /src/backend/utils/adt/lockfuncs.c
parenteb5c4e953bbd2fab07be74df93f4080bab60176c (diff)
downloadpostgresql-cd9479af2af25d7fa9bfd24dd4dcf976b360f077.tar.gz
postgresql-cd9479af2af25d7fa9bfd24dd4dcf976b360f077.zip
Improve GIN cost estimation
GIN index scans were not taking any descent CPU-based cost into account. That made them look cheaper than other types of indexes when they shouldn't be. We use the same heuristic as for btree indexes, but multiply it by the number of searched entries. Additionally, the CPU cost for the tree was based largely on a genericcostestimate. For a GIN index, we should not charge index quals per tuple, but per entry. On top of this, charge cpu_index_tuple_cost per actual tuple. This should fix the cases where a GIN index is preferred over a btree and the ones where a memoize node is not added on top of the GIN index scan because it seemed too cheap. We don't packpatch this to evade unexpected plan changes in stable versions. Discussion: https://postgr.es/m/CABs3KGQnOkyQ42-zKQqiE7M0Ks9oWDSee%3D%2BJx3-TGq%3D68xqWYw%40mail.gmail.com Discussion: https://postgr.es/m/3188617.44csPzL39Z%40aivenronan Author: Ronan Dunklau Reported-By: Hung Nguyen Reviewed-by: Tom Lane, Alexander Korotkov
Diffstat (limited to 'src/backend/utils/adt/lockfuncs.c')
0 files changed, 0 insertions, 0 deletions