pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Shreeyansh Dba <shreeyansh2014@gmail.com>
Cc: Mariel Cherkassky <mariel.cherkassky@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Cc: PostgreSQL mailing lists <pgsql-performance@postgresql.org>
Subject: Re: pg_locks - what is a virtualxid locktype
Date: Tue, 29 Jan 2019 12:12:18 -0300
Message-ID: <201901291512.n532mfd7od4x@alvherre.pgsql> (raw)
In-Reply-To: <CAGDYbUP6O3uhe=X2m5VPVj-Z3a5_Dh+WtZPJYTMud0h+NKW72A@mail.gmail.com>

On 2019-Jan-29, Shreeyansh Dba wrote:

> The virtualxid lock is special. It’s a exclusive lock on the transaction’s
> own virtual transaction ID that every transaction always holds. No other
> transaction can ever acquire it while the transaction is running.
> The purpose of this is to allow one transaction to wait until another
> transaction commits or rolls back using PostgreSQL’s locking mechanism, and
> it’s used internally.

A little more specific than that: it's used when some process (such as
CREATE INDEX CONCURRENTLY) needs to wait even on sessions that might be
read-only.  Such transactions don't have transaction-ids that write
transactions have, which is why the only way is to wait on the virtual
transaction-id.


-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (3+ messages)

Message-ID: <201901291512.n532mfd7od4x@alvherre.pgsql>
Permalink:  ../201901291512.n532mfd7od4x@alvherre.pgsql/
Also on:    postgresql.org/message-id/201901291512.n532mfd7od4x@alvherre.pgsql

 · 

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-performance@postgresql.org
  Cc: alvherre@2ndquadrant.com, shreeyansh2014@gmail.com, mariel.cherkassky@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: pg_locks - what is a virtualxid locktype
  In-Reply-To: <201901291512.n532mfd7od4x@alvherre.pgsql>

* 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