Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goXUj-0002WV-QS for pgsql-admin@arkaria.postgresql.org; Tue, 29 Jan 2019 17:48:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1goXUi-0006CJ-3G for pgsql-admin@arkaria.postgresql.org; Tue, 29 Jan 2019 17:48:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goXUh-0006CB-KO for pgsql-admin@lists.postgresql.org; Tue, 29 Jan 2019 17:48:19 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goXUe-0000lI-1C for pgsql-admin@lists.postgresql.org; Tue, 29 Jan 2019 17:48:18 +0000 Received: by mail-ed1-x543.google.com with SMTP id o10so16634875edt.13 for ; Tue, 29 Jan 2019 09:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=ow8qsDxlhkF2hLrPZ35vYEPNc+fo6YiPEQa+Hk9eXOM=; b=tLV+MUq1iUe9OooAwEk9g7jneZOOBA5x86a6HRWooOBKaXrWE5y3QGldkWno9kqX75 c2P6C5xUGmu+lv6vT55uSXTojnJH+lzKzUOMm4DAqvwAsJqtYnLnNato66L47ytSAU44 eQGuTgk2LBG6KGaOqWsgluFnp6VKcXWVnrNyOfSFDuMU9heSt9B8jdjeN+kDUPMi+3Hf 4RzFx7N4kXtwmH08EPnhoI/Pn1Mmze1XCQ5ZHwc0E1mFcrQPxX9+7Mtda3dTMBoDMsKG siVgLbzSz1QIITFHv6BDJZPE3EcfqXWzOlTmpqtkcb3EokjWSGbeh/5mTETcmW9m6oEQ g0ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ow8qsDxlhkF2hLrPZ35vYEPNc+fo6YiPEQa+Hk9eXOM=; b=n67MLAdm1y4FjAokzgOmYou0eWlvDVv2eh6wX9rHT/er+1IuP05BAkf9u0g+gKCxga bmCYT85DwPPIz85rMHGquvt+SfhZQNvCs06DOHBjGq1CT3kgWM8Lotn8JwpjoaLW3cbR qHmThXb3QPCeIArbxraO+7Rg0oPnVMDDwzXPwrFwY8DKj7vd1LC0xWqhZGlhYhna+l3U JlM56zoZdZJyyI6dDe13rrbEwLH6r02Q4+YfzaE1/urbln1+SMTN1OitRhGrWcxCAYog b6kpzjialt5fPLkDhVibaBJDHO6io7OkvPyZ1t1Io3jHiIt0BRw2SewKRN9+SjZZezYu ESyw== X-Gm-Message-State: AJcUukcCtKrWaT3mc17GtQA5su/ReOrfYO15yjjjczgPbod0RPhm71FO At5875rigt6qA9amGZwJQBbuxw== X-Google-Smtp-Source: ALg8bN4jbb681IS+gFklPDJUiK6OX82bOpkrr4Sx3EDugKm23dPW9IQuGGYxeBHksk+IjLz5I8kKDw== X-Received: by 2002:a50:d5dc:: with SMTP id g28mr16835887edj.226.1548784094440; Tue, 29 Jan 2019 09:48:14 -0800 (PST) Received: from alvin.alvh.no-ip.org ([212.76.254.98]) by smtp.gmail.com with ESMTPSA id m10sm2346291eja.38.2019.01.29.09.48.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jan 2019 09:48:13 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 06CB7A74; Tue, 29 Jan 2019 12:12:18 -0300 (-03) Date: Tue, 29 Jan 2019 12:12:18 -0300 From: Alvaro Herrera To: Shreeyansh Dba Cc: Mariel Cherkassky , Pgsql-admin , PostgreSQL mailing lists Subject: Re: pg_locks - what is a virtualxid locktype Message-ID: <201901291512.n532mfd7od4x@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716-1013-2c1e88 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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