From e57345975cf8ddbf044bfd164359e74e1a9bcab2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 2 May 2006 22:25:10 +0000 Subject: Clean up API for ambulkdelete/amvacuumcleanup as per today's discussion. This formulation requires every AM to provide amvacuumcleanup, unlike before, but it's surely a whole lot cleaner. Also, add an 'amstorage' column to pg_am so that we can get rid of hardwired knowledge in DefineOpClass(). --- doc/src/sgml/catalogs.sgml | 16 +++++++++++++++- doc/src/sgml/indexam.sgml | 46 +++++++++++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 20 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 43f0c166e0a..fe993aa4eeb 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1,4 +1,4 @@ - + @@ -394,6 +394,13 @@ Does the access method support null index entries? + + amstorage + bool + + Can index storage data type differ from column data type? + + amconcurrent bool @@ -401,6 +408,13 @@ Does the access method support concurrent updates? + + amclusterable + bool + + Can an index of this type be CLUSTERed on? + + aminsert regproc diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index 623066b66cc..01381ff7058 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -1,4 +1,4 @@ - + Index Access Method Interface Definition @@ -184,44 +184,52 @@ aminsert (Relation indexRelation, IndexBulkDeleteResult * -ambulkdelete (Relation indexRelation, +ambulkdelete (IndexVacuumInfo *info, + IndexBulkDeleteResult *stats, IndexBulkDeleteCallback callback, void *callback_state); Delete tuple(s) from the index. This is a bulk delete operation that is intended to be implemented by scanning the whole index and checking each entry to see if it should be deleted. - The passed-in callback function may be called, in the style + The passed-in callback function must be called, in the style callback(TID, callback_state) returns bool, to determine whether any particular index entry, as identified by its referenced TID, is to be deleted. Must return either NULL or a palloc'd struct containing statistics about the effects of the deletion operation. + It is OK to return NULL if no information needs to be passed on to + amvacuumcleanup. - If callback_state is NULL then no tuples are to be deleted. - The index AM may choose to optimize this case (eg by not scanning the - index) but it is still expected to deliver accurate statistics. + Because of limited maintenance_work_mem, + ambulkdelete may need to be called more than once when many + tuples are to be deleted. The stats argument is the result + of the previous call for this index (it is NULL for the first call within a + VACUUM operation). This allows the AM to accumulate statistics + across the whole operation. Typically, ambulkdelete will + modify and return the same struct if the passed stats is not + null. IndexBulkDeleteResult * -amvacuumcleanup (Relation indexRelation, - IndexVacuumCleanupInfo *info, +amvacuumcleanup (IndexVacuumInfo *info, IndexBulkDeleteResult *stats); - Clean up after a VACUUM operation (one or more - ambulkdelete calls). An index access method does not have - to provide this function (if so, the entry in pg_am must - be zero). If it is provided, it is typically used for bulk cleanup - such as reclaiming empty index pages. info - provides some additional arguments such as a message level for statistical - reports, and stats is whatever the last - ambulkdelete call returned. amvacuumcleanup - may replace or modify this struct before returning it. If the result - is not NULL it must be a palloc'd struct. The statistics it contains - will be reported by VACUUM if VERBOSE is given. + Clean up after a VACUUM operation (zero or more + ambulkdelete calls). This does not have to do anything + beyond returning index statistics, but it may perform bulk cleanup + such as reclaiming empty index pages. stats is whatever the + last ambulkdelete call returned, or NULL if + ambulkdelete was not called because no tuples needed to be + deleted. If the result is not NULL it must be a palloc'd struct. + The statistics it contains will be used to update pg_class, + and will be reported by VACUUM if VERBOSE is given. + It is OK to return NULL if the index was not changed at all during the + VACUUM operation, but otherwise correct stats should + be returned. -- cgit v1.2.3