2 -- Check that system tables can be reindexed.
4 -- Note that this test currently is not included in the default
5 -- schedules, as currently reindexing catalog tables can cause
8 -- * The lock upgrade between the ShareLock acquired for the reindex
9 -- and RowExclusiveLock needed for pg_class/pg_index locks can
12 -- * The uniqueness checks performed when reindexing a unique/primary
13 -- key index possibly need to wait for the transaction of a
14 -- about-to-deleted row in pg_class to commit. That can cause
15 -- deadlocks because, in contrast to user tables, locks on catalog
16 -- tables are routinely released before commit - therefore the lock
17 -- held for reindexing doesn't guarantee that no running transaction
18 -- performed modifications in the table underlying the index.
20 -- This is particularly problematic as such conflicts can be
21 -- triggered even when run in isolation, as a previous session's
22 -- temporary table cleanup might still be running (even when the
23 -- session ended from a client perspective).
24 -- Check reindexing of whole tables
25 REINDEX TABLE pg_class; -- mapped, non-shared, critical
26 REINDEX TABLE pg_index; -- non-mapped, non-shared, critical
27 REINDEX TABLE pg_operator; -- non-mapped, non-shared, critical
28 REINDEX TABLE pg_database; -- mapped, shared, critical
29 REINDEX TABLE pg_shdescription; -- mapped, shared non-critical
30 -- Check that individual system indexes can be reindexed. That's a bit
31 -- different from the entire-table case because reindex_relation
32 -- treats e.g. pg_class special.
33 REINDEX INDEX pg_class_oid_index; -- mapped, non-shared, critical
34 REINDEX INDEX pg_class_relname_nsp_index; -- mapped, non-shared, non-critical
35 REINDEX INDEX pg_index_indexrelid_index; -- non-mapped, non-shared, critical
36 REINDEX INDEX pg_index_indrelid_index; -- non-mapped, non-shared, non-critical
37 REINDEX INDEX pg_database_oid_index; -- mapped, shared, critical
38 REINDEX INDEX pg_shdescription_o_c_index; -- mapped, shared, non-critical
39 -- Check the same REINDEX INDEX statements under parallelism.
41 SET min_parallel_table_scan_size = 0;
42 REINDEX INDEX pg_class_oid_index; -- mapped, non-shared, critical
43 REINDEX INDEX pg_class_relname_nsp_index; -- mapped, non-shared, non-critical
44 REINDEX INDEX pg_index_indexrelid_index; -- non-mapped, non-shared, critical
45 REINDEX INDEX pg_index_indrelid_index; -- non-mapped, non-shared, non-critical
46 REINDEX INDEX pg_database_oid_index; -- mapped, shared, critical
47 REINDEX INDEX pg_shdescription_o_c_index; -- mapped, shared, non-critical