diff options
| author | Amit Kapila | 2021-12-22 02:25:14 +0000 |
|---|---|---|
| committer | Amit Kapila | 2021-12-22 02:25:14 +0000 |
| commit | cc8b25712b5ed8809048c7e209882bb0981214d6 (patch) | |
| tree | 43db261c3bcca5f99b7fdf624bb24a2b58e9b6f7 /src/include/commands | |
| parent | 0f2abd05441f524a67bc58ef5f0cc32054f7fb66 (diff) | |
Move index vacuum routines to vacuum.c.
An upcoming patch moves parallel vacuum code out of vacuumlazy.c. This
code restructuring will allow both lazy vacuum and parallel vacuum to use
index vacuum functions.
Author: Masahiko Sawada
Reviewed-by: Hou Zhijie, Amit Kapila
Discussion: https://www.postgresql.org/message-id/20211030212101.ae3qcouatwmy7tbr%40alap3.anarazel.de
Diffstat (limited to 'src/include/commands')
| -rw-r--r-- | src/include/commands/vacuum.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index 4cfd52eaf4d..97bffa8ff19 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -15,6 +15,7 @@ #define VACUUM_H #include "access/htup.h" +#include "access/genam.h" #include "catalog/pg_class.h" #include "catalog/pg_statistic.h" #include "catalog/pg_type.h" @@ -230,6 +231,21 @@ typedef struct VacuumParams int nworkers; } VacuumParams; +/* + * VacDeadItems stores TIDs whose index tuples are deleted by index vacuuming. + */ +typedef struct VacDeadItems +{ + int max_items; /* # slots allocated in array */ + int num_items; /* current # of entries */ + + /* Sorted array of TIDs to delete from indexes */ + ItemPointerData items[FLEXIBLE_ARRAY_MEMBER]; +} VacDeadItems; + +#define MAXDEADITEMS(avail_mem) \ + (((avail_mem) - offsetof(VacDeadItems, items)) / sizeof(ItemPointerData)) + /* GUC parameters */ extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for PostGIS */ extern int vacuum_freeze_min_age; @@ -282,6 +298,12 @@ extern bool vacuum_is_relation_owner(Oid relid, Form_pg_class reltuple, extern Relation vacuum_open_relation(Oid relid, RangeVar *relation, bits32 options, bool verbose, LOCKMODE lmode); +extern IndexBulkDeleteResult *vac_bulkdel_one_index(IndexVacuumInfo *ivinfo, + IndexBulkDeleteResult *istat, + VacDeadItems *dead_items); +extern IndexBulkDeleteResult *vac_cleanup_one_index(IndexVacuumInfo *ivinfo, + IndexBulkDeleteResult *istat); +extern Size vac_max_items_to_alloc_size(int max_items); /* in commands/analyze.c */ extern void analyze_rel(Oid relid, RangeVar *relation, |
