mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Get rid of pg_class.reltoastidxid.
Treat TOAST index just the same as normal one and get the OID of TOAST index from pg_index but not pg_class.reltoastidxid. This change allows us to handle multiple TOAST indexes, and which is required infrastructure for upcoming REINDEX CONCURRENTLY feature. Patch by Michael Paquier, reviewed by Andres Freund and me.
This commit is contained in:
@ -1744,15 +1744,6 @@
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><structfield>reltoastidxid</structfield></entry>
|
||||
<entry><type>oid</type></entry>
|
||||
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
|
||||
<entry>
|
||||
For a TOAST table, the OID of its index. 0 if not a TOAST table.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><structfield>relhasindex</structfield></entry>
|
||||
<entry><type>bool</type></entry>
|
||||
|
@ -20,12 +20,12 @@
|
||||
stored. If the table has any columns with potentially-wide values,
|
||||
there also might be a <acronym>TOAST</> file associated with the table,
|
||||
which is used to store values too wide to fit comfortably in the main
|
||||
table (see <xref linkend="storage-toast">). There will be one index on the
|
||||
<acronym>TOAST</> table, if present. There also might be indexes associated
|
||||
with the base table. Each table and index is stored in a separate disk
|
||||
file — possibly more than one file, if the file would exceed one
|
||||
gigabyte. Naming conventions for these files are described in <xref
|
||||
linkend="storage-file-layout">.
|
||||
table (see <xref linkend="storage-toast">). There will be one valid index
|
||||
on the <acronym>TOAST</> table, if present. There also might be indexes
|
||||
associated with the base table. Each table and index is stored in a
|
||||
separate disk file — possibly more than one file, if the file would
|
||||
exceed one gigabyte. Naming conventions for these files are described
|
||||
in <xref linkend="storage-file-layout">.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -44,7 +44,7 @@
|
||||
<programlisting>
|
||||
SELECT pg_relation_filepath(oid), relpages FROM pg_class WHERE relname = 'customer';
|
||||
|
||||
pg_relation_filepath | relpages
|
||||
pg_relation_filepath | relpages
|
||||
----------------------+----------
|
||||
base/16384/16806 | 60
|
||||
(1 row)
|
||||
@ -65,12 +65,12 @@ FROM pg_class,
|
||||
FROM pg_class
|
||||
WHERE relname = 'customer') AS ss
|
||||
WHERE oid = ss.reltoastrelid OR
|
||||
oid = (SELECT reltoastidxid
|
||||
FROM pg_class
|
||||
WHERE oid = ss.reltoastrelid)
|
||||
oid = (SELECT indexrelid
|
||||
FROM pg_index
|
||||
WHERE indrelid = ss.reltoastrelid)
|
||||
ORDER BY relname;
|
||||
|
||||
relname | relpages
|
||||
relname | relpages
|
||||
----------------------+----------
|
||||
pg_toast_16806 | 0
|
||||
pg_toast_16806_index | 1
|
||||
@ -87,7 +87,7 @@ WHERE c.relname = 'customer' AND
|
||||
c2.oid = i.indexrelid
|
||||
ORDER BY c2.relname;
|
||||
|
||||
relname | relpages
|
||||
relname | relpages
|
||||
----------------------+----------
|
||||
customer_id_indexdex | 26
|
||||
</programlisting>
|
||||
@ -101,7 +101,7 @@ SELECT relname, relpages
|
||||
FROM pg_class
|
||||
ORDER BY relpages DESC;
|
||||
|
||||
relname | relpages
|
||||
relname | relpages
|
||||
----------------------+----------
|
||||
bigtable | 3290
|
||||
customer | 3144
|
||||
|
@ -1163,12 +1163,12 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
|
||||
<row>
|
||||
<entry><structfield>tidx_blks_read</></entry>
|
||||
<entry><type>bigint</></entry>
|
||||
<entry>Number of disk blocks read from this table's TOAST table index (if any)</entry>
|
||||
<entry>Number of disk blocks read from this table's TOAST table indexes (if any)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><structfield>tidx_blks_hit</></entry>
|
||||
<entry><type>bigint</></entry>
|
||||
<entry>Number of buffer hits in this table's TOAST table index (if any)</entry>
|
||||
<entry>Number of buffer hits in this table's TOAST table indexes (if any)</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
|
Reference in New Issue
Block a user