agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Laurenz Albe <laurenz.albe@cybertec.at>
To: Shaozhong SHI <shishaozhong@gmail.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: How to explicitly lock and unlock tables in pgsql?
Date: Thu, 17 Mar 2022 08:51:52 +0100
Message-ID: <eed4b6bcda07d197f54a5ea4c1c1194c67778673.camel@cybertec.at> (raw)
In-Reply-To: <CA+i5JwZPLEiOQxFy3q=5HKWYLkfs8VBvHxY03osiW4xy_OoKxw@mail.gmail.com>
References: <CA+i5JwZPLEiOQxFy3q=5HKWYLkfs8VBvHxY03osiW4xy_OoKxw@mail.gmail.com>
On Wed, 2022-03-16 at 20:30 +0000, Shaozhong SHI wrote:
> Table locks present a barrier for progressing queries.
>
> How to explicitly lock and unlock tables in pgsql, so that we can guarantee the progress of running scripts?
You cannot unlock tables except by ending the transaction which took the lock.
The first thing you should do is to make sure that all your database transactions are short.
Also, you should nevr explicitly lock tables. Table locks are taken automatically
by the SQL statements you are executing.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
view thread (6+ messages) latest in thread
Message-ID: <eed4b6bcda07d197f54a5ea4c1c1194c67778673.camel@cybertec.at>
Permalink: ../eed4b6bcda07d197f54a5ea4c1c1194c67778673.camel@cybertec.at/
Also on: postgresql.org/message-id/eed4b6bcda07d197f54a5ea4c1c1194c67778673.camel@cybertec.at
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: laurenz.albe@cybertec.at, shishaozhong@gmail.com, pgsql-general@lists.postgresql.org
Subject: Re: How to explicitly lock and unlock tables in pgsql?
In-Reply-To: <eed4b6bcda07d197f54a5ea4c1c1194c67778673.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox