From: Tom Lane <tgl@sss.pgh.pa.us>
To: arun chirappurath <arunsnmimt@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_locks-exclusivelock for select queries
Date: Fri, 22 Mar 2024 10:18:50 -0400
Message-ID: <899843.1711117130@sss.pgh.pa.us> (raw)
In-Reply-To: <CAA23Sdt_abrMxJnZbJj5-rr5Z5C1J_UXUnORnbuCg8x3TZ6JoA@mail.gmail.com>
References: <CAA23Sdt_abrMxJnZbJj5-rr5Z5C1J_UXUnORnbuCg8x3TZ6JoA@mail.gmail.com>
arun chirappurath <arunsnmimt@gmail.com> writes:
> I am running below query on a database. why is it creating a exclusive lock
> on a virtualxid? I am running some SELECT queries and its creating an
> ExclusiveLock in virtualxid? is this normal?
Yes. That lock has nothing to do with any table, only with the
transaction's own existence. It can't conflict when acquired,
because the virtual XID is unique (at least across existing sessions).
It exists so that other sessions can wait for this one if needful, by
trying to take share lock on the virtualxid.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, arunsnmimt@gmail.com
Subject: Re: pg_locks-exclusivelock for select queries
In-Reply-To: <899843.1711117130@sss.pgh.pa.us>
References: <CAA23Sdt_abrMxJnZbJj5-rr5Z5C1J_UXUnORnbuCg8x3TZ6JoA@mail.gmail.com> <899843.1711117130@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox