Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteb5c4e9

Browse files
committed
Extract the multiplier for CPU process cost of index page into a macro
B-tree, GiST and SP-GiST all charge 50.0 * cpu_operator_cost for processingan index page. Extract this to a macro to avoid repeated magic numbers.Discussion:https://mail.google.com/mail/u/0/?ik=a20b091faa&view=om&permmsgid=msg-f%3A1751459697261369543Author: Ronan Dunklau
1 parent57d11ef commiteb5c4e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/backend/utils/adt/selfuncs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
#include"utils/timestamp.h"
141141
#include"utils/typcache.h"
142142

143+
#defineDEFAULT_PAGE_CPU_MULTIPLIER 50.0
143144

144145
/* Hooks for plugins to get control when we ask for stats */
145146
get_relation_stats_hook_typeget_relation_stats_hook=NULL;
@@ -6865,7 +6866,7 @@ btcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
68656866
* touched. The number of such pages is btree tree height plus one (ie,
68666867
* we charge for the leaf page too). As above, charge once per SA scan.
68676868
*/
6868-
descentCost= (index->tree_height+1)*50.0*cpu_operator_cost;
6869+
descentCost= (index->tree_height+1)*DEFAULT_PAGE_CPU_MULTIPLIER*cpu_operator_cost;
68696870
costs.indexStartupCost+=descentCost;
68706871
costs.indexTotalCost+=costs.num_sa_scans*descentCost;
68716872

@@ -7060,7 +7061,7 @@ gistcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
70607061
/*
70617062
* Likewise add a per-page charge, calculated the same as for btrees.
70627063
*/
7063-
descentCost= (index->tree_height+1)*50.0*cpu_operator_cost;
7064+
descentCost= (index->tree_height+1)*DEFAULT_PAGE_CPU_MULTIPLIER*cpu_operator_cost;
70647065
costs.indexStartupCost+=descentCost;
70657066
costs.indexTotalCost+=costs.num_sa_scans*descentCost;
70667067

@@ -7115,7 +7116,7 @@ spgcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
71157116
/*
71167117
* Likewise add a per-page charge, calculated the same as for btrees.
71177118
*/
7118-
descentCost= (index->tree_height+1)*50.0*cpu_operator_cost;
7119+
descentCost= (index->tree_height+1)*DEFAULT_PAGE_CPU_MULTIPLIER*cpu_operator_cost;
71197120
costs.indexStartupCost+=descentCost;
71207121
costs.indexTotalCost+=costs.num_sa_scans*descentCost;
71217122

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp