aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/amapi.h
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2024-09-10 09:51:55 +0200
committerPeter Eisentraut <peter@eisentraut.org>2024-09-10 10:03:23 +0200
commit56fead44dcc70df9f9188fee08e5aefe3da43ccc (patch)
treee7b2c776e4d5f2727403d19c16066d6ffb28a741 /src/include/access/amapi.h
parentf5050f795aea67dfc40bbc429c8934e9439e22e7 (diff)
downloadpostgresql-56fead44dcc70df9f9188fee08e5aefe3da43ccc.tar.gz
postgresql-56fead44dcc70df9f9188fee08e5aefe3da43ccc.zip
Add amgettreeheight index AM API routine
The only current implementation is for btree where it calls _bt_getrootheight(). Other index types can now also use this to pass information to their amcostestimate routine. Previously, btree was hardcoded and other index types could not hook into the optimizer at this point. Author: Mark Dilger <mark.dilger@enterprisedb.com> Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
Diffstat (limited to 'src/include/access/amapi.h')
-rw-r--r--src/include/access/amapi.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/access/amapi.h b/src/include/access/amapi.h
index f25c9d58a7d..c51de742ea0 100644
--- a/src/include/access/amapi.h
+++ b/src/include/access/amapi.h
@@ -140,6 +140,13 @@ typedef void (*amcostestimate_function) (struct PlannerInfo *root,
double *indexCorrelation,
double *indexPages);
+/* estimate height of a tree-structured index
+ *
+ * XXX This just computes a value that is later used by amcostestimate. This
+ * API could be expanded to support passing more values if the need arises.
+ */
+typedef int (*amgettreeheight_function) (Relation rel);
+
/* parse index reloptions */
typedef bytea *(*amoptions_function) (Datum reloptions,
bool validate);
@@ -272,6 +279,7 @@ typedef struct IndexAmRoutine
amvacuumcleanup_function amvacuumcleanup;
amcanreturn_function amcanreturn; /* can be NULL */
amcostestimate_function amcostestimate;
+ amgettreeheight_function amgettreeheight; /* can be NULL */
amoptions_function amoptions;
amproperty_function amproperty; /* can be NULL */
ambuildphasename_function ambuildphasename; /* can be NULL */