From a72cfcd523887f1220473231d7982928acc23684 Mon Sep 17 00:00:00 2001 From: Hari Babu 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 pg_am 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 . + Currently, only table and indexes have access methods. The requirements for table + access methods are discussed in detail in and the + requirements for index access methods are discussed in detail in . diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml index a03ea1427b..7e37042a55 100644 --- a/doc/src/sgml/filelist.sgml +++ b/doc/src/sgml/filelist.sgml @@ -89,6 +89,7 @@ + diff --git a/doc/src/sgml/postgres.sgml b/doc/src/sgml/postgres.sgml index 96d196d229..3e115f1c76 100644 --- a/doc/src/sgml/postgres.sgml +++ b/doc/src/sgml/postgres.sgml @@ -250,6 +250,7 @@ &tablesample-method; &custom-scan; &geqo; + &tableam; &indexam; &generic-wal; &btree; 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 @@ + + + + Table Access Method Interface Definition + + + This chapter defines the interface between the core PostgreSQL + system and access methods, which manage TABLE + 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. + + + + All Tables in PostgreSQL system are the primary + data store. Each table is stored as its own physical relation + and so is described by an entry in the pg_class + catalog. A table's content is entirely controlled by its access method. + (All the access methods furthermore use the standard page layout described + in .) + + + + Each table access method is described by a row in the + pg_am system + catalog. The pg_am entry specifies a type + of the access method and a handler function for the + access method. These entries can be created and deleted using the + and SQL commands. + + + + A table access method handler function must be declared to accept a single + argument of type internal and to return the pseudo-type + table_am_handler. 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 TableAmRoutine, + which contains everything that the core code needs to know to make use of + the table access method. The TableAmRoutine struct, + also called the access method's API struct, 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 TableAmRoutine structure. For more details, please + refer the file src/include/access/tableam.h. + + + + Any new TABLE access method developers can refer the exisitng + HEAP implementation present in the src/backend/heap/heapam_handler.c + for more details of how it is implemented for HEAP access method. + + + -- 2.20.1.windows.1