From b58d77a3a5b4282bbac4e98a4eb933539933dec2 Mon Sep 17 00:00:00 2001 From: David Wicinas <93669463+dwicinas@users.noreply.github.com> Date: Mon, 1 Apr 2024 10:48:08 -0400 Subject: [PATCH 1/6] Added information about lock levels --- .../pg_extensions/pg_squeeze/using.mdx | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx index a2f0ecf1369..d3f0de420ff 100644 --- a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx +++ b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx @@ -3,9 +3,29 @@ title: Using pg_squeeze navTitle: Using --- +## Understanding lock levels while using `pg_squeeze` + +While using `pg_squeeze`, the extension performs a series of actions, and some of these actions place locks on data, as described below. The table being squeezed is available for both read and write operations by other transactions most of the time. + +When squeezing a table, `pg_squeeze': + +1. Creates a transient table and copies the contents of the source table using the snapshot. + `pg_squeeze` holds an `ACCESS SHARE` lock on the source table during this step. + +1. Builds indexes on the transient table. + `pg_squeeze` holds an `ACCESS SHARE` lock on the source table during this step. + +1. Decodes and applies the concurrent changes that occurred on the source table while the initial load was in progress. + +1. Applies any concurrent changes that took place while waiting for the lock and swaps the storage of the transient and the source table. + `pg_squeeze` holds an `ACCESS EXCLUSIVE` lock for a short period during this step. + +1. Drops the transient table + + ## Registering a table for regular processing -First, ensure that your table has either a primary key or a unique constraint. This is necessary to process changes resulting from other transactions while `pg_squeeze` is doing its work. +Before using `pg_squeeze`, ensure that your table has either a primary key or a replica identity. This is necessary to process changes resulting from other transactions while `pg_squeeze` is doing its work. To make the `pg_squeeze` extension aware of the table, you must insert a record into the `squeeze.tables` table. After it is added, table statistics are checked periodically. When the table meets the necessary criteria to be squeezed, a task is added to a queue. The tasks are processed sequentially, in the order they are created. From 8b6b486bd6ea8d19b9f9db3b34357278ff71b2a5 Mon Sep 17 00:00:00 2001 From: David Wicinas <93669463+dwicinas@users.noreply.github.com> Date: Mon, 1 Apr 2024 11:21:03 -0400 Subject: [PATCH 2/6] minor edits --- advocacy_docs/pg_extensions/pg_squeeze/using.mdx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx index d3f0de420ff..95682f8566f 100644 --- a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx +++ b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx @@ -5,19 +5,22 @@ navTitle: Using ## Understanding lock levels while using `pg_squeeze` -While using `pg_squeeze`, the extension performs a series of actions, and some of these actions place locks on data, as described below. The table being squeezed is available for both read and write operations by other transactions most of the time. +While using `pg_squeeze`, the extension performs a series of actions, and some of these actions place locks on data, as described in the following steps. The table being squeezed is available for both read and write operations by other transactions most of the time. -When squeezing a table, `pg_squeeze': +When squeezing a table, the extension: + +1. Creates a transient table and copies the contents of the source table using the snapshot. -1. Creates a transient table and copies the contents of the source table using the snapshot. `pg_squeeze` holds an `ACCESS SHARE` lock on the source table during this step. 1. Builds indexes on the transient table. + `pg_squeeze` holds an `ACCESS SHARE` lock on the source table during this step. -1. Decodes and applies the concurrent changes that occurred on the source table while the initial load was in progress. +1. Decodes and applies the concurrent changes that occurred on the source table while the initial load is in progress. -1. Applies any concurrent changes that took place while waiting for the lock and swaps the storage of the transient and the source table. +1. Applies any concurrent changes that take place while waiting for the lock and swaps the storage of the transient and the source table. + `pg_squeeze` holds an `ACCESS EXCLUSIVE` lock for a short period during this step. 1. Drops the transient table From 43e71a0e5fbddcfa41361e8ba3ba4ea786f1af68 Mon Sep 17 00:00:00 2001 From: David Wicinas <93669463+dwicinas@users.noreply.github.com> Date: Tue, 2 Apr 2024 08:32:02 -0400 Subject: [PATCH 3/6] minor edits suggested by shruthikc --- advocacy_docs/pg_extensions/pg_squeeze/using.mdx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx index 95682f8566f..c99430a9245 100644 --- a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx +++ b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx @@ -2,10 +2,9 @@ title: Using pg_squeeze navTitle: Using --- - ## Understanding lock levels while using `pg_squeeze` -While using `pg_squeeze`, the extension performs a series of actions, and some of these actions place locks on data, as described in the following steps. The table being squeezed is available for both read and write operations by other transactions most of the time. +While using `pg_squeeze`, the extension performs a series of actions, and some of these actions place locks on tables, as described in the following steps. The table being squeezed is available for both read and write operations by other transactions most of the time. When squeezing a table, the extension: @@ -23,7 +22,7 @@ When squeezing a table, the extension: `pg_squeeze` holds an `ACCESS EXCLUSIVE` lock for a short period during this step. -1. Drops the transient table +1. Drops the transient table. ## Registering a table for regular processing From 7dd1c297330929157efa6bd6bcaf7f25631e17c0 Mon Sep 17 00:00:00 2001 From: David Wicinas <93669463+dwicinas@users.noreply.github.com> Date: Tue, 2 Apr 2024 09:06:51 -0400 Subject: [PATCH 4/6] another minor edit --- advocacy_docs/pg_extensions/pg_squeeze/using.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx index c99430a9245..0a5faac78f4 100644 --- a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx +++ b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx @@ -2,6 +2,9 @@ title: Using pg_squeeze navTitle: Using --- + +The following sections explain how to use `pg_squeeze`. + ## Understanding lock levels while using `pg_squeeze` While using `pg_squeeze`, the extension performs a series of actions, and some of these actions place locks on tables, as described in the following steps. The table being squeezed is available for both read and write operations by other transactions most of the time. From 0cfab2479eb3119d81e57ed7cffeffd4b062ece1 Mon Sep 17 00:00:00 2001 From: David Wicinas <93669463+dwicinas@users.noreply.github.com> Date: Tue, 2 Apr 2024 09:18:04 -0400 Subject: [PATCH 5/6] another small edit suggested by Shruthi --- advocacy_docs/pg_extensions/pg_squeeze/using.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx index 0a5faac78f4..c60d2de4be8 100644 --- a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx +++ b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx @@ -7,7 +7,7 @@ The following sections explain how to use `pg_squeeze`. ## Understanding lock levels while using `pg_squeeze` -While using `pg_squeeze`, the extension performs a series of actions, and some of these actions place locks on tables, as described in the following steps. The table being squeezed is available for both read and write operations by other transactions most of the time. +While using `pg_squeeze`, the extension performs a series of actions, and some of these actions place a lock on the squeezed table, as described in the following steps. The table being squeezed is available for both read and write operations by other transactions most of the time. When squeezing a table, the extension: From 0a8502b76ff2832348d1e3cfbbdaf2cd4200fb2e Mon Sep 17 00:00:00 2001 From: David Wicinas <93669463+dwicinas@users.noreply.github.com> Date: Wed, 3 Apr 2024 08:51:22 -0400 Subject: [PATCH 6/6] Small editorial change recommended by Betsy --- advocacy_docs/pg_extensions/pg_squeeze/using.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx index c60d2de4be8..3a4f2d1a416 100644 --- a/advocacy_docs/pg_extensions/pg_squeeze/using.mdx +++ b/advocacy_docs/pg_extensions/pg_squeeze/using.mdx @@ -3,7 +3,7 @@ title: Using pg_squeeze navTitle: Using --- -The following sections explain how to use `pg_squeeze`. +Use `pg_squeeze` to remove unused space from a table and optionally sort tuples according to a particular index. ## Understanding lock levels while using `pg_squeeze`