You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Implement support for bulk inserts in postgres_fdw
Extends the FDW API to allow batching inserts into foreign tables. Thatis usually much more efficient than inserting individual rows, due tohigh latency for each round-trip to the foreign server.It was possible to implement something similar in the regular FDW API,but it was inconvenient and there were issues with reporting the numberof actually inserted rows etc. This extends the FDW API with two newfunctions:* GetForeignModifyBatchSize - allows the FDW picking optimal batch size* ExecForeignBatchInsert - inserts a batch of rows at onceCurrently, only INSERT queries support batching. Support for DELETE andUPDATE may be added in the future.This also implements batching for postgres_fdw. The batch size may bespecified using "batch_size" option both at the server and table level.The initial patch version was written by me, but it was rewritten andimproved in many ways by Takayuki Tsunakawa.Author: Takayuki TsunakawaReviewed-by: Tomas Vondra, Amit LangoteDiscussion:https://postgr.es/m/20200628151002.7x5laxwpgvkyiu3q@development
Output: NULL::integer, 1001, 101, 'foo'::text, NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying, 'ft1 '::character(10), NULL::user_enum
3892
-
(4 rows)
3893
+
(5 rows)
3893
3894
3894
3895
ALTER TABLE "S 1"."T 1" RENAME TO "T 0";
3895
3896
ALTER FOREIGN TABLE ft1 OPTIONS (SET table_name 'T 0');
Output: NULL::integer, 1001, 101, 'foo'::text, NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying, 'ft1 '::character(10), NULL::user_enum
3925
-
(4 rows)
3927
+
(5 rows)
3926
3928
3927
3929
ALTER TABLE "S 1"."T 0" RENAME TO "T 1";
3928
3930
ALTER FOREIGN TABLE ft1 OPTIONS (SET table_name 'T 1');
@@ -4244,12 +4246,13 @@ INSERT INTO ft2 (c1,c2,c3) SELECT c1+1000,c2+100, c3 || c3 FROM ft2 LIMIT 20;
Output: "*SELECT*"."?column?", "*SELECT*"."?column?_1", NULL::integer, "*SELECT*"."?column?_2", NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying, 'ft2 '::character(10), NULL::user_enum
Output: 1200, 999, NULL::integer, 'foo'::text, NULL::timestamp with time zone, NULL::timestamp without time zone, NULL::character varying, 'ft2 '::character(10), NULL::user_enum
5365
-
(5 rows)
5369
+
(6 rows)
5366
5370
5367
5371
INSERT INTO ft2 (c1,c2,c3) VALUES (1200,999,'foo') RETURNING tableoid::regclass;
5368
5372
tableoid
@@ -6212,9 +6216,10 @@ INSERT INTO rw_view VALUES (0, 5);