Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pYqmy-0002cM-4Z for pgsql-general@arkaria.postgresql.org; Sun, 05 Mar 2023 16:00:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pYqmw-00032I-N0 for pgsql-general@arkaria.postgresql.org; Sun, 05 Mar 2023 16:00:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pYqmw-000329-CT for pgsql-general@lists.postgresql.org; Sun, 05 Mar 2023 16:00:42 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pYqmv-0005XT-36 for pgsql-general@lists.postgresql.org; Sun, 05 Mar 2023 16:00:42 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1469C5C014D; Sun, 5 Mar 2023 11:00:40 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 05 Mar 2023 11:00:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1678032040; x=1678118440; bh=Y/SCdlPKDn4PlLR992NeVHrozKjgMH9MBzP P1Ljy1/g=; b=Ftp5SvQ3NijR+yjlB2N015dzN9gkUHk3pRGKkkYmfGHSNf7sS0A iMtD4yEAffvIqNFD0wzO/fQY+3hatGLWjEudwUUYEcz8q6PPzu9JVNwrC0IV7XPm CJydSTOkgseG+njmOAKYceuQRDQ4dnUAkYPBxMhkUHwCFeT4ki/5e2NMC4YBtCk1 v76OOkAxtHPdTl43QwArr1Vgv+Wvbvh93ygY0+F7u2kqwDHWI9SSHpELfu+pslWw dSMdUWOo13rcudsckQYKPpipzhsdGJe5HtoDq9XNezo3/+bM0ZNJ59SXqIth5YJ4 BS++f/suNmJCs4eBsCMv42dwqdlKmnr1Cuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1678032040; x= 1678118440; bh=Y/SCdlPKDn4PlLR992NeVHrozKjgMH9MBzPP1Ljy1/g=; b=k Cuxg7sp89FDdmu6QtUMt2xTa0WKqjNdSk2PA7BPgRTO6gQvVFesAtm4GAsA5CIBI 1F5JEw/Ui3E660hrAViQi2A1VbKRMuSLWXuaHWB4nDYmDG9nR5i49wr8pDUbGK81 hBBwB5cbK2/eMaENTUFrjASK0SMfKOQ912XOJ/Uc/PO0QPmBcWV9SjwnaLX18kMH 0UMprM5EhrJF6tU206UrGCzc65kw4cZtPK3Bu3neYXzHmbAnPnJnTvs34Yoqyc1c a9FQVjBMuG7TDIYGJsUNUNU83NvSDovGpUpKEgUtZ44oGpphXXaxGgCMuhG4lJA5 r1XBpLe0iQC9PoAQuKInQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddtgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuhffvfhgjtgfgsehtke ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepleejvdelgf elgeejgeejiefhtdejhfehgeeghedvjeejffefvefhffdtgefhffejnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 5 Mar 2023 11:00:39 -0500 (EST) Message-ID: Date: Sun, 5 Mar 2023 08:00:38 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: what's hsitoric MVCC Snapshot? Content-Language: en-US From: Adrian Klaver To: "jacktby@gmail.com" , pgsql-general References: <202303052249108283258@gmail.com> <3bff79c9-5118-1e73-69d7-04a9b7c83c0e@aklaver.com> In-Reply-To: <3bff79c9-5118-1e73-69d7-04a9b7c83c0e@aklaver.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/5/23 07:58, Adrian Klaver wrote: > On 3/5/23 06:49, jacktby@gmail.com wrote: >> Here are the comments in src/include/utils/snapshot.h. >> /* >> * For normal MVCC snapshot this contains the all xact IDs that are in >> * progress, unless the snapshot was taken during recovery in which case >> * it's empty. For historic MVCC snapshots, the meaning is inverted, i.e. >> * it contains *committed* transactions between xmin and xmax. >> * >> * note: all ids in xip[] satisfy xmin <= xip[i] < xmax >> */ >> TransactionId *xip; >> I can't understand the historic MVCC snapshots? can you give me >> a scenario >> to describe this? > > From the same file: > > > /* >  * A tuple is visible iff it follows the rules of SNAPSHOT_MVCC, but >  * supports being called in timetravel context (for decoding catalog >  * contents in the context of logical decoding). >          */ > SNAPSHOT_HISTORIC_MVCC, Also: typedef struct SnapshotData *Snapshot; #define InvalidSnapshot ((Snapshot) NULL) /* * Struct representing all kind of possible snapshots. * * There are several different kinds of snapshots: * * Normal MVCC snapshots * * MVCC snapshots taken during recovery (in Hot-Standby mode) * * Historic MVCC snapshots used during logical decoding * * snapshots passed to HeapTupleSatisfiesDirty() * * snapshots passed to HeapTupleSatisfiesNonVacuumable() * * snapshots used for SatisfiesAny, Toast, Self where no members are * accessed. * * TODO: It's probably a good idea to split this struct using a NodeTag * similar to how parser and executor nodes are handled, with one type for * each different kind of snapshot to avoid overloading the meaning of * individual fields. */ > >> ------------------------------------------------------------------------ >> jacktby@gmail.com > -- Adrian Klaver adrian.klaver@aklaver.com