Re: Asynchronous Append on postgres_fdw nodes.
Andrei Lepikhov <a.lepikhov@postgrespro.ru>
From: "Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>
To: Etsuro Fujita <etsuro.fujita@gmail.com>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-04-26T06:01:12Z
Lists: pgsql-hackers
On 4/23/21 8:12 AM, Etsuro Fujita wrote:
> I have committed the patch.
While studying the capabilities of AsyncAppend, I noticed an
inconsistency with the cost model of the optimizer:
async_capable = off:
--------------------
Append (cost=100.00..695.00 ...)
-> Foreign Scan on f1 part_1 (cost=100.00..213.31 ...)
-> Foreign Scan on f2 part_2 (cost=100.00..216.07 ...)
-> Foreign Scan on f3 part_3 (cost=100.00..215.62 ...)
async_capable = on:
-------------------
Append (cost=100.00..695.00 ...)
-> Async Foreign Scan on f1 part_1 (cost=100.00..213.31 ...)
-> Async Foreign Scan on f2 part_2 (cost=100.00..216.07 ...)
-> Async Foreign Scan on f3 part_3 (cost=100.00..215.62 ...)
Here I see two problems:
1. Cost of an AsyncAppend is the same as cost of an Append. But
execution time of the AsyncAppend for three remote partitions has more
than halved.
2. Cost of an AsyncAppend looks as a sum of the child ForeignScan costs.
I haven't ideas why it may be a problem right now. But I can imagine
that it may be a problem in future if we have alternative paths: complex
pushdown in synchronous mode (a few rows to return) or simple
asynchronous append with a large set of rows to return.
--
regards,
Andrey Lepikhov
Postgres Professional
Commits
-
Improve comments for trivial_subqueryscan().
- 4a8a5dd7f59c 15.0 landed
-
Disable asynchronous execution if using gating Result nodes.
- ebb790241523 14.3 landed
- 5c854e7a2c8a 15.0 landed
-
Allow asynchronous execution in more cases.
- c2bb02bc2e85 15.0 landed
-
Doc: Further update documentation for asynchronous execution.
- eab81953682d 14.0 landed
-
Fix rescanning of async-aware Append nodes.
- f3baaf28a6da 14.0 landed
-
Doc: Update documentation for asynchronous execution.
- 15fcd33e0694 14.0 landed
-
Fix EXPLAIN ANALYZE for async-capable nodes.
- a363bc6da96b 14.0 landed
-
Minor code cleanup in asynchronous execution support.
- bb684c82f733 14.0 landed
-
Adjust input value to WaitEventSetWait() in ExecAppendAsyncEventWait().
- a8af856d3257 14.0 landed
-
Add support for asynchronous execution.
- 27e1f14563cf 14.0 landed