diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2024-09-10 09:51:55 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2024-09-10 10:03:23 +0200 |
commit | 56fead44dcc70df9f9188fee08e5aefe3da43ccc (patch) | |
tree | e7b2c776e4d5f2727403d19c16066d6ffb28a741 /doc/src | |
parent | f5050f795aea67dfc40bbc429c8934e9439e22e7 (diff) | |
download | postgresql-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 'doc/src')
-rw-r--r-- | doc/src/sgml/indexam.sgml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index e3c1539a1e3..dc7d14b60dd 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -146,6 +146,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 */ @@ -480,6 +481,21 @@ amcostestimate (PlannerInfo *root, <para> <programlisting> +int +amgettreeheight (Relation rel); +</programlisting> + Compute the height of a tree-shaped index. This information is supplied to + the <function>amcostestimate</function> function in + <literal>path->indexinfo->tree_height</literal> and can be used to support + the cost estimation. The result is not used anywhere else, so this + function can actually be used to compute any kind of data (that fits into + an integer) about the index that the cost estimation function might want to + know. If the computation is expensive, it could be useful to cache the + result as part of <literal>RelationData.rd_amcache</literal>. + </para> + + <para> +<programlisting> bytea * amoptions (ArrayType *reloptions, bool validate); |