mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-24 00:17:19 +02:00
Allow a partition be detached from its partitioned table without blocking concurrent queries, by running in two transactions and only requiring ShareUpdateExclusive in the partitioned table. Because it runs in two transactions, it cannot be used in a transaction block. This is the main reason to use dedicated syntax: so that users can choose to use the original mode if they need it. But also, it doesn't work when a default partition exists (because an exclusive lock would still need to be obtained on it, in order to change its partition constraint.) In case the second transaction is cancelled or a crash occurs, there's ALTER TABLE .. DETACH PARTITION .. FINALIZE, which executes the final steps. The main trick to make this work is the addition of column pg_inherits.inhdetachpending, initially false; can only be set true in the first part of this command. Once that is committed, concurrent transactions that use a PartitionDirectory will include or ignore partitions so marked: in optimizer they are ignored if the row is marked committed for the snapshot; in executor they are always included. As a result, and because of the way PartitionDirectory caches partition descriptors, queries that were planned before the detach will see the rows in the detached partition and queries that are planned after the detach, won't. A CHECK constraint is created that duplicates the partition constraint. This is probably not strictly necessary, and some users will prefer to remove it afterwards, but if the partition is re-attached to a partitioned table, the constraint needn't be rechecked. Author: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Amit Langote <amitlangote09@gmail.com> Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> Discussion: https://postgr.es/m/20200803234854.GA24158@alvherre.pgsql
99 lines
2.3 KiB
Plaintext
99 lines
2.3 KiB
Plaintext
test: read-only-anomaly
|
|
test: read-only-anomaly-2
|
|
test: read-only-anomaly-3
|
|
test: read-write-unique
|
|
test: read-write-unique-2
|
|
test: read-write-unique-3
|
|
test: read-write-unique-4
|
|
test: simple-write-skew
|
|
test: receipt-report
|
|
test: temporal-range-integrity
|
|
test: project-manager
|
|
test: classroom-scheduling
|
|
test: total-cash
|
|
test: referential-integrity
|
|
test: ri-trigger
|
|
test: partial-index
|
|
test: two-ids
|
|
test: multiple-row-versions
|
|
test: index-only-scan
|
|
test: predicate-lock-hot-tuple
|
|
test: update-conflict-out
|
|
test: deadlock-simple
|
|
test: deadlock-hard
|
|
test: deadlock-soft
|
|
test: deadlock-soft-2
|
|
test: deadlock-parallel
|
|
test: detach-partition-concurrently-1
|
|
test: detach-partition-concurrently-2
|
|
test: detach-partition-concurrently-3
|
|
test: detach-partition-concurrently-4
|
|
test: fk-contention
|
|
test: fk-deadlock
|
|
test: fk-deadlock2
|
|
test: fk-partitioned-1
|
|
test: fk-partitioned-2
|
|
test: eval-plan-qual
|
|
test: eval-plan-qual-trigger
|
|
test: lock-update-delete
|
|
test: lock-update-traversal
|
|
test: inherit-temp
|
|
test: insert-conflict-do-nothing
|
|
test: insert-conflict-do-nothing-2
|
|
test: insert-conflict-do-update
|
|
test: insert-conflict-do-update-2
|
|
test: insert-conflict-do-update-3
|
|
test: insert-conflict-specconflict
|
|
test: delete-abort-savept
|
|
test: delete-abort-savept-2
|
|
test: aborted-keyrevoke
|
|
test: multixact-no-deadlock
|
|
test: multixact-no-forget
|
|
test: lock-committed-update
|
|
test: lock-committed-keyupdate
|
|
test: update-locked-tuple
|
|
test: reindex-concurrently
|
|
test: reindex-schema
|
|
test: propagate-lock-delete
|
|
test: tuplelock-conflict
|
|
test: tuplelock-update
|
|
test: tuplelock-upgrade-no-deadlock
|
|
test: tuplelock-partition
|
|
test: freeze-the-dead
|
|
test: nowait
|
|
test: nowait-2
|
|
test: nowait-3
|
|
test: nowait-4
|
|
test: nowait-5
|
|
test: skip-locked
|
|
test: skip-locked-2
|
|
test: skip-locked-3
|
|
test: skip-locked-4
|
|
test: drop-index-concurrently-1
|
|
test: multiple-cic
|
|
test: alter-table-1
|
|
test: alter-table-2
|
|
test: alter-table-3
|
|
test: alter-table-4
|
|
test: create-trigger
|
|
test: sequence-ddl
|
|
test: async-notify
|
|
test: vacuum-reltuples
|
|
test: timeouts
|
|
test: vacuum-concurrent-drop
|
|
test: vacuum-conflict
|
|
test: vacuum-skip-locked
|
|
test: horizons
|
|
test: predicate-hash
|
|
test: predicate-gist
|
|
test: predicate-gin
|
|
test: partition-concurrent-attach
|
|
test: partition-key-update-1
|
|
test: partition-key-update-2
|
|
test: partition-key-update-3
|
|
test: partition-key-update-4
|
|
test: plpgsql-toast
|
|
test: truncate-conflict
|
|
test: serializable-parallel
|
|
test: serializable-parallel-2
|