Re: Pluggable Storage - Andres's take
Andres Freund <andres@anarazel.de>
Attachments
- 0001-tableam-docs.patch (text/x-diff)
Hi, On 2019-04-02 17:11:07 +1100, Haribabu Kommi wrote: > From a72cfcd523887f1220473231d7982928acc23684 Mon Sep 17 00:00:00 2001 > From: Hari Babu <kommi.haribabu@gmail.com> > Date: Tue, 2 Apr 2019 15:41:17 +1100 > Subject: [PATCH 1/2] tableam : doc update of table access methods > > Providing basic explanation of table access methods > including their structure details and reference heap > implementation files. > --- > doc/src/sgml/catalogs.sgml | 5 ++-- > doc/src/sgml/filelist.sgml | 1 + > doc/src/sgml/postgres.sgml | 1 + > doc/src/sgml/tableam.sgml | 56 ++++++++++++++++++++++++++++++++++++++ > 4 files changed, 61 insertions(+), 2 deletions(-) > create mode 100644 doc/src/sgml/tableam.sgml > > diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml > index f4aabf5dc7..200708e121 100644 > --- a/doc/src/sgml/catalogs.sgml > +++ b/doc/src/sgml/catalogs.sgml > @@ -587,8 +587,9 @@ > The catalog <structname>pg_am</structname> stores information about > relation access methods. There is one row for each access method supported > by the system. > - Currently, only indexes have access methods. The requirements for index > - access methods are discussed in detail in <xref linkend="indexam"/>. > + Currently, only table and indexes have access methods. The requirements for table > + access methods are discussed in detail in <xref linkend="tableam"/> and the > + requirements for index access methods are discussed in detail in <xref linkend="indexam"/>. > </para> I also adapted pg_am.amtype. > diff --git a/doc/src/sgml/tableam.sgml b/doc/src/sgml/tableam.sgml > new file mode 100644 > index 0000000000..9eca52ee70 > --- /dev/null > +++ b/doc/src/sgml/tableam.sgml > @@ -0,0 +1,56 @@ > +<!-- doc/src/sgml/tableam.sgml --> > + > +<chapter id="tableam"> > + <title>Table Access Method Interface Definition</title> > + > + <para> > + This chapter defines the interface between the core <productname>PostgreSQL</productname> > + system and <firstterm>access methods</firstterm>, which manage <literal>TABLE</literal> > + types. The core system knows nothing about these access methods beyond > + what is specified here, so it is possible to develop entirely new access > + method types by writing add-on code. > + </para> > + > + <para> > + All Tables in <productname>PostgreSQL</productname> system are the primary > + data store. Each table is stored as its own physical <firstterm>relation</firstterm> > + and so is described by an entry in the <structname>pg_class</structname> > + catalog. A table's content is entirely controlled by its access method. > + (All the access methods furthermore use the standard page layout described > + in <xref linkend="storage-page-layout"/>.) > + </para> I don't think there's actually any sort of dependency on the page layout. It's entirely conceivable to write an AM that doesn't use postgres' shared buffers. > + <para> > + A table access method handler function must be declared to accept a single > + argument of type <type>internal</type> and to return the pseudo-type > + <type>table_am_handler</type>. The argument is a dummy value that simply > + serves to prevent handler functions from being called directly from SQL commands. > + The result of the function must be a palloc'd struct of type <structname>TableAmRoutine</structname>, > + which contains everything that the core code needs to know to make use of > + the table access method. That's not been correct for a while... > The <structname>TableAmRoutine</structname> struct, > + also called the access method's <firstterm>API struct</firstterm>, includes > + fields specifying assorted fixed properties of the access method, such as > + whether it can support bitmap scans. More importantly, it contains pointers > + to support functions for the access method, which do all of the real work to > + access tables. These support functions are plain C functions and are not > + visible or callable at the SQL level. The support functions are described > + in <structname>TableAmRoutine</structname> structure. For more details, please > + refer the file <filename>src/include/access/tableam.h</filename>. > + </para> This seems to not have been adapted after copying it from indexam? I'm still working on this (in particular I think storage.sgml and probably some other places needs updates to make clear they apply to heap not generally; I think there needs to be some references to generic WAL records in tableam.sgml, ...), but I got to run a few errands. One thing I want to call out is that I made the reference to src/include/access/tableam.h a link to gitweb. I think that makes it much more useful to the casual reader. But it also means that, baring some infrastructure / procedure we don't have, the link will just continue to point to master. I'm not particularly concerned about that, but it seems worth pointing out, given that we've only a single link to gitweb in the sgml docs so far. Greetings, Andres Freund
Commits
-
Add default_table_access_method to postgresql.conf.sample.
- 3a5c08aa0267 12.0 landed
- f7db0ac7d5b6 13.0 landed
-
tableam: Avoid relying on relation size to determine validity of tids.
- 147e3722f7e5 12.0 landed
-
tableam: Don't assume that every AM uses md.c style storage.
- 7f44ede59414 12.0 landed
-
Allow pg_class xid & multixid horizons to not be set.
- fdc7efcc30b1 12.0 landed
-
Fix slot type issue for fuzzy distance index scan over out-of-core table AM.
- b8b94ea129ff 12.0 cited
-
tableam: comment and formatting fixes.
- 6421011ea24d 12.0 landed
-
table: docs: fix typos and grammar.
- 86cc06d1cf9c 12.0 landed
-
tableam: basic documentation.
- b73c3a11963c 12.0 landed
-
Only allow heap in a number of contrib modules.
- 4b82664156c2 12.0 landed
-
tableam: Add table_finish_bulk_insert().
- d45e40158623 12.0 landed
-
tableam: sample scan.
- 73c954d24896 12.0 landed
-
tableam: bitmap table scan.
- bfbcad478f05 12.0 landed
-
tableam: Move heap specific logic from estimate_rel_size below tableam.
- 696d78469f37 12.0 landed
-
tableam: VACUUM and ANALYZE support.
- 737a292b5de2 12.0 landed
-
tableam: relation creation, VACUUM FULL/CLUSTER, SET TABLESPACE.
- d25f519107bf 12.0 landed
-
tableam: Support for an index build's initial table scan(s).
- 2a96909a4a8c 12.0 landed
-
tableam: Add table_get_latest_tid, to wrap heap_get_latest_tid.
- 2e3da03e9ee4 12.0 landed
-
tableam: Add helper for indexes to check if a corresponding table tuples exist.
- 71bdc99d0d7c 12.0 landed
-
tableam: Add and use table_fetch_row_version().
- 9a8ee1dc650b 12.0 landed
-
tableam: Use in CREATE TABLE AS and CREATE MATERIALIZED VIEW.
- 919e48b94301 12.0 landed
-
Ensure sufficient alignment for ParallelTableScanDescData in BTShared.
- 8cacea7a7251 12.0 landed
-
Don't reuse slots between root and partition in ON CONFLICT ... UPDATE.
- 277cb789836b 12.0 landed
-
Use a virtual rather than a heap slot in two places where that suffices.
- 70b9bda65f81 12.0 landed
-
Store tuples for EvalPlanQual in slots, rather than as HeapTuples.
- ad0bda5d24ea 12.0 landed
-
Use slots in trigger infrastructure, except for the actual invocation.
- ff11e7f4b9ae 12.0 landed
-
Store table oid and tuple's tid in tuple slots directly.
- b8d71745eac0 12.0 landed
-
Allow to use HeapTupleData embedded in [Buffer]HeapTupleTableSlot.
- 5408e233f066 12.0 landed
-
Add ExecStorePinnedBufferHeapTuple.
- 8aa02b52db11 12.0 landed
-
Add ArchiveOpts to pass options to ArchiveEntry
- f831d4accda0 12.0 cited
-
Rename RelationData.rd_amroutine to rd_indam.
- 346ed70b0ad7 12.0 landed
-
Rephrase references to "time qualification".
- ebcc7bf949ba 12.0 landed
-
Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c.
- c91560defc57 12.0 landed
-
Move generic snapshot related code from tqual.h to snapmgr.h.
- b7eda3e0e334 12.0 landed
-
Remove superfluous tqual.h includes.
- e7cc78ad43eb 12.0 landed
-
Don't duplicate parallel seqscan shmem sizing logic in nbtree.
- 90525d7b4e0f 12.0 landed
-
Move vacuumlazy.c into access/heap.
- 285d8e12055f 12.0 landed
-
Support parallel bitmap heap scans.
- f35742ccb7aa 10.0 cited