Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tkM5n-0037uF-DD for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Feb 2025 11:48:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tkM5m-009T4v-0s for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Feb 2025 11:48:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tkM5l-009T4n-O3 for pgsql-hackers@lists.postgresql.org; Tue, 18 Feb 2025 11:48:45 +0000 Received: from m16.mail.163.com ([220.197.31.3]) by makus.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1tkM5d-001VWk-1T for pgsql-hackers@lists.postgresql.org; Tue, 18 Feb 2025 11:48:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=wFqCFYOYPGPv48sDU8S7Jj+be3kd/pcJIFccnWkF7L0=; b=MCcoW6IF754wSKYAnGyTVR7v2vTx0OFofN2szZVUBHFMWl9PadnGThYMdcr0k9 mtfL7k+EucyNlKJk59pxbKYFFd1vPWa41T0dRIOtls8850m0M1jm5097d4wfSp+2 Q6yunv1AFJc12j51gnKk2pKCgfTk79r4EkpWPRqn38LA0= Received: from lovely-coding (unknown []) by gzga-smtp-mtada-g0-3 (Coremail) with SMTP id _____wAnzZGOc7Rnkm71MQ--.34074S3; Tue, 18 Feb 2025 19:48:31 +0800 (CST) From: Andy Fan To: "pgsql-hackers@lists.postgresql.org" Subject: Why does exec_simple_query requires 2 snapshots Date: Tue, 18 Feb 2025 11:48:30 +0000 Message-ID: <87o6yzbhip.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID:_____wAnzZGOc7Rnkm71MQ--.34074S3 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjTR5xhvUUUUU X-Originating-IP: [219.151.179.207] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/xtbBzxv3U2e0aGGZlgAAsl List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, When I run "SELECT * FROM pg_class LIMIT 1"; then postgresql run GetSnapshotData twice, one is /* * Set up a snapshot if parse analysis/planning will need one. */ if (analyze_requires_snapshot(parsetree)) { PushActiveSnapshot(GetTransactionSnapshot()); snapshot_set = true; } the other one is in PortalStart. My question is why can't we share the same snapshot for the 2 cases? parser & planner requires Catalog Snapshot which should be the latest one, but in the above case, looks the executor can reuse it as well. Is there anything I missed? Thanks -- Best Regards Andy Fan