Why does exec_simple_query requires 2 snapshots

From: Andy Fan <zhihuifan1213(at)163(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Why does exec_simple_query requires 2 snapshots
Date: 2025-02-18 11:48:30
Message-ID: 87o6yzbhip.fsf@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2025-02-18 12:01:55 Re: Should heapam_estimate_rel_size consider fillfactor?
Previous Message David Rowley 2025-02-18 11:45:23 Re: Modify an incorrect regression test case in the group by key value elimination function