RE: POC: postgres_fdw insert batching

tsunakawa.takay@fujitsu.com <tsunakawa.takay@fujitsu.com>

From: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>
To: 'Tomas Vondra' <tomas.vondra@enterprisedb.com>
Cc: 'Tomas Vondra' <tomas.vondra@2ndquadrant.com>, "Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-11-17T09:11:55Z
Lists: pgsql-hackers

Attachments

Hello,


Modified the patch as I talked with Tomas-san.  The performance results of loading one million records into a hash-partitioned table with 8 partitions are as follows:

    unpatched, local: 8.6 seconds
	    unpatched, fdw: 113.7 seconds
    patched, fdw: 12.5 seconds  (9x improvement)

The test scripts are also attached.  Run prepare.sql once to set up tables and source data.  Run local_part.sql and fdw_part.sql to load source data into a partitioned table with local partitions and a partitioned table with foreign tables respectively.


Regards
Takayuki Tsunakawa

Commits

  1. Fix tuple routing to initialize batching only for inserts

  2. Fix pointer type in ExecForeignBatchInsert SGML docs

  3. Fix initialization of FDW batching in ExecInitModifyTable

  4. Implement support for bulk inserts in postgres_fdw