From 6e2d7bfca12e1aeb58bd77d96b9c222b759df33d Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Thu, 25 Nov 2021 13:41:42 +0800 Subject: [PATCH] Fix documentation to reflect that hypopg_list_indexes is now a view. Thanks to Duc Hoang for the report. --- README.md | 6 +++--- docs/usage.rst | 38 +++++++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index d4f153a..9f28f94 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ a future release. You can check the available hypothetical indexes in your own backend: - rjuju=# SELECT * FROM hypopg_list_indexes(); + rjuju=# SELECT * FROM hypopg_list_indexes ; indexrelid | indexname | nspname | relname | amname -----------+-------------------------------------------+---------+---------+-------- 205101 | <41072>btree_hypo_id | public | hypo | btree @@ -96,6 +96,6 @@ Of course, only `EXPLAIN` without `ANALYZE` will use hypothetical indexes: (5 rows) To remove your backend's hypothetical indexes, you can use the function -`hypopg_drop_index(indexrelid)` with the OID that the `hypopg_list_indexes()` -function returns and call `hypopg_reset()` to remove all at once, or just close +`hypopg_drop_index(indexrelid)` with the OID that the `hypopg_list_indexes` +view returns and call `hypopg_reset()` to remove all at once, or just close your current connection. diff --git a/docs/usage.rst b/docs/usage.rst index d3fcbef..b879a79 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -174,41 +174,53 @@ use such indexes. Manipulate hypothetical indexes ------------------------------- -Some other convenience functions are available: +Some other convenience functions and views are available: -- **hypopg_list_indexes()**: list all hypothetical indexes that have been - created +- **hypopg_list_indexes**: view that lists all hypothetical indexes that have + been created .. code-block:: psql - SELECT * FROM hypopg_list_indexes() + SELECT * FROM hypopg_list_indexes ; indexrelid | indexname | nspname | relname | amname ------------+----------------------+---------+---------+-------- 18284 | <18284>btree_hypo_id | public | hypo | btree (1 row) -- **hypopg_get_indexdef(oid)**: get the CREATE INDEX statement that would - recreate a stored hypothetical index +- **hypopg()**: fuctions that lists all hypothetical indexes that have + been created with the same format as **pg_index** .. code-block:: psql - SELECT indexname, hypopg_get_indexdef(indexrelid) FROM hypopg_list_indexes() ; - indexname | hypopg_get_indexdef + SELECT * FROM hypopg() ; + indexname | indexrelid | indrelid | innatts | indisunique | indkey | indcollation | indclass | indoption | indexprs | indpred | amid +----------------------+------------+----------+---------+-------------+--------+--------------+----------+-----------+----------+---------+------ + <18284>btree_hypo_id | 13543 | 18122 | 1 | f | 1 | 0 | 1978 | | | | 403 +(1 row) + +- **hypopg_get_indexdef(oid)**: function that lists the CREATE INDEX statement + that would recreate a stored hypothetical index + +.. code-block:: psql + + SELECT indexname, hypopg_get_indexdef(indexrelid) FROM hypopg_list_indexes ; + indexname | hypopg_get_indexdef ----------------------+---------------------------------------------- <18284>btree_hypo_id | CREATE INDEX ON public.hypo USING btree (id) (1 row) -- **hypopg_relation_size(oid)**: estimate how big a hypothetical index would - be: +- **hypopg_relation_size(oid)**: function that estimates how big a hypothetical + index would be: .. code-block:: psql SELECT indexname, pg_size_pretty(hypopg_relation_size(indexrelid)) - FROM hypopg_list_indexes() ; + FROM hypopg_list_indexes ; indexname | pg_size_pretty ----------------------+---------------- <18284>btree_hypo_id | 2544 kB (1 row) -- **hypopg_drop_index(oid)**: remove the given hypothetical index -- **hypopg_reset()**: remove all hypothetical indexes +- **hypopg_drop_index(oid)**: function that removes the given hypothetical + index +- **hypopg_reset()**: function that removes all hypothetical indexes