From: | Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com> |
---|---|
To: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Multiple call of GetTransactionSnapshot in single flow |
Date: | 2014-11-19 05:36:21 |
Message-ID: | BF2827DCCE55594C8D7A8F7FFD3AB77158E6129F@SZXEML508-MBX.china.huawei.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I have observed in some places like exec_bind_message and exec_simple_query,
Though these two function have already got snapshot but before they call function PortalStart,
current snapshot gets popped off and then they pass InvalidSnapshot as parameter
because of which inside PortalStart again snapshot is taken.
In cases where many transactions are running, taking snapshot multiple times may be very costly.
What is the reason for taking snapshot multiple time:
1. Is this implementation to make sure snapshot is at more granular level ?
2. Is it something do with current command id of the snapshot?
3. Or there is any other specific reason for this, which I am not able visualize?
4. Or am I missing something else?
If it is just reason 1, then maybe we can try to pass the same snapshot to PortalStart as taken in caller, it can enhance the performance in many case.
With this change, I did one small performance test on pgbench with "prepared queries for pgbench select with 16 users and observed performance benefit of 10%".
Please provide your opinion?
Thanks and Regards,
Kumar Rajeev Rastogi
From | Date | Subject | |
---|---|---|---|
Next Message | Etsuro Fujita | 2014-11-19 05:44:48 | Re: inherit support for foreign tables |
Previous Message | Fujii Masao | 2014-11-19 05:34:50 | psql \watch always ignores \pset null |