1 year ago
#232268
Gerard Jaryczewski
Slow performance of Postgresql script with foreign server
As a former SQL Server developer, I am curious, why that kind of script can be extremely slow in Postgresql?
I have some tables on local database in public schema, and I configured a foreign server with postgres-fdw, and foreign tables are mapped in linked schema locally, and the script looks like below:
INSERT INTO linked.table_1 (column_1, column_2) SELECT column_1, column_2 FROM public.table_1;
INSERT INTO linked.table_2 (column_1, column_2) SELECT column_1, column_2 FROM public.table_2;
INSERT INTO linked.table_3 (column_1, column_2) SELECT column_1, column_2 FROM public.table_3;
-- more tables like this...
INSERT INTO linked.table_50 (column_1, column_2) SELECT column_1, column_2 FROM public.table_50;
Tables are small (tens, hundreds or thousands of records), so it should be pretty fast, but it takes long minutes. Why?
postgresql
performance
foreign-data-wrapper
0 Answers
Your Answer