Why does exec_simple_query requires 2 snapshots - Mailing list pgsql-hackers

From Andy Fan
Subject Why does exec_simple_query requires 2 snapshots
Date
Msg-id 87o6yzbhip.fsf@163.com
Whole thread Raw
Responses Re: Why does exec_simple_query requires 2 snapshots
List 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




pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Modify an incorrect regression test case in the group by key value elimination function
Next
From: Zhang Mingli
Date:
Subject: Re: Fix outdated code comments in nodeAgg.c