why do we need two snapshots per query?
От | Robert Haas |
---|---|
Тема | why do we need two snapshots per query? |
Дата | |
Msg-id | CA+TgmoYqKRj9BozjB-+tLQgVkSvzPFWBEzRF4PM2xjPOsmFRdw@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: why do we need two snapshots per query?
Re: why do we need two snapshots per query? |
Список | pgsql-hackers |
I noticed while playing around this morning that, in read committed mode, the following query - or any other straightforward query - calls GetSnapshotData() twice: SELECT 1; What happens is this: exec_simple_query() calls analyze_requires_snapshot() on the query. Since the query is a SELECT, this returns true, whereupon exec_simple_query() takes a snapshot for parse analysis / planning. It then plans the query and releases the snapshot. exec_simple_query() then calls CreatePortal(), PortalDefineQuery(), and PortalStart(), the last of which takes a new snapshot to run the query. Considering that GetSnapshotData() is the number-one consumer of CPU time on many profiling runs I've done, this seems needlessly inefficient. Can't we arrange to retain the snapshot used for parse analysis / planning and reuse it for the portal that we create just afterwards? Off the top of my head, I'm not exactly sure how to do that cleanly, but it seems like it should work. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: