You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[PGPRO-12159] Added functions for low-level inspect of the RUM index pages.
This commit adds six functions for low-level inspect of the RUM index pages:
1. rum_metapage_info() -- returns information about a RUM index metapage.
2. rum_page_opaque_info() -- returns information from the opaque area of the
index's RUM page.
3. rum_internal_entry_page_items() -- returns information that is stored on
the internal pages of the entry tree.
4. rum_leaf_entry_page_items() -- returns information that is stored on the
leaf pages of the entry tree.
5. rum_internal_data_page_items() -- returns information that is stored on
the internal pages of the posting tree.
6. rum_leaf_data_page_items() -- returns information that is stored on the
leaf pages of the posting tree.
To extract information, all these functions need to pass the index name and
the page number.
These functions are described in more detail in README.md
Tags: rum
`rum_page_opaque_info` returns information about a RUM index opaque area: `left` and `right` links, `maxoff` -- the number of elements that are stored on the page (this parameter is used differently for different types of pages), `freespace` -- free space on the page.
### `rum_internal_entry_page_items(rel_name text, blk_num int4) returns set of record`
346
+
347
+
`rum_internal_entry_page_items` returns information that is stored on the internal pages of the entry tree (it is extracted from `IndexTuples`). For example:
Tue May 1021:21:22.3267242016 | 2 | RUM_CAT_NORM_KEY | 83
358
+
Sat May 1419:21:22.3267242016 | 2 | RUM_CAT_NORM_KEY | 84
359
+
Wed May 1817:21:22.3267242016 | 2 | RUM_CAT_NORM_KEY | 85
360
+
+inf | | | 86
361
+
(79 rows)
362
+
```
363
+
364
+
RUM (like GIN) on the internal pages of the entry tree packs the downward link and the key in pairs of the following type: `(P_n, K_{n+1})`. It turns out that there is no key for `P_0` (it is assumed to be equal to `-inf`), and for the last key `K_{n+1}` there is no downward link (it is assumed that it is the largest key (or high key) in the subtree to which the `P_n` link leads). For this reason (the key is `+inf` because it is the rightmost page at the current level of the tree), in the example above, the last line contains the key `+inf` (this key does not have a downward link).
365
+
366
+
### `rum_leaf_entry_page_items(rel_name text, blk_num int4) returns set of record`
367
+
368
+
`rum_leaf_entry_page_items` returns information that is stored on the entry tree leaf pages (it is extracted from compressed posting lists). For example:
Each posting list is an `IndexTuple` that stores the key value and a compressed list of `tids`. In the function `rum_leaf_entry_page_items()`, the key value is attached to each `tid` for convenience, but on the page it is stored in a single instance.
388
+
389
+
If the number of `tids` is too large, then instead of a posting list, a posting tree will be used for storage. In the example above, a posting tree was created (the key in the posting tree is the `tid`) for the key with the value `b9`. In this case, instead of the posting list, the magic number and the page number, which is the root of the posting tree, are stored inside the `IndexTuple`.
390
+
391
+
### `rum_internal_data_page_items(rel_name text, blk_num int4) returns set of record`
392
+
393
+
`rum_internal_data_page_items` returns information that is stored on the internal pages of the posting tree (it is extracted from arrays of `RumPostingItem` structures). For example:
Each element on the internal pages of the posting tree contains the high key (`tid`) value for the child page and a link to this child page (as well as additional information if it was added when creating the index).
406
+
407
+
At the beginning of the internal pages of the posting tree, the high key of this page is always stored (if it has the value `(0,0)`, this is equivalent to `+inf`; this is always performed if the page is the rightmost).
408
+
409
+
At the moment, RUM does not support storing (as additional information) the data type that is pass by reference on the internal pages of the posting tree. Therefore, this output is possible:
f | 23 | (39,43) | f | varlena types in posting tree is not supported
416
+
f | 22 | (74,9) | f | varlena types in posting tree is not supported
417
+
...
418
+
```
419
+
420
+
### `rum_leaf_data_page_items(rel_name text, blk_num int4) returns set of record`
421
+
422
+
`rum_leaf_data_page_items` the function returns information that is stored on the leaf pages of the postnig tree (it is extracted from compressed posting lists). For example:
Unlike entry tree leaf pages, on posting tree leaf pages, compressed posting lists are not stored in an `IndexTuple`. The high key is the largest key on the page.
436
+
309
437
## Todo
310
438
311
439
- Allow multiple additional information (lexemes positions + timestamp).
0 commit comments