[HACKERS] Proposal to add work_mem option to postgres_fdw module

From: "Shinoda, Noriyoshi (PN Japan GCS Delivery)" <noriyoshi(dot)shinoda(at)hpe(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [HACKERS] Proposal to add work_mem option to postgres_fdw module
Date: 2018-08-17 06:06:48
Message-ID: TU4PR8401MB04306CD1C4D52F92CC2D5B5AEE3D0@TU4PR8401MB0430.NAMPRD84.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

The attached patch adds a new option work_mem to postgres_fdw contrib module.

Previously, it was impossible to change the setting of work_mem for remote session with connection by postgres_fdw.

By adding this option to the CREATE SERVER statement, you can also change the work_mem setting for remote sessions with postgres_fdw.

Usage is the same as other options, and specify work_mem as an option of the CREATE SERVER statement. The string you specify is the same as the format of work_mem in GUC.

Example

----------

postgres=# CREATE SERVER remsvr1 FOREIGN DATA WRAPPER postgres_fdw OPTIONS ( host 'remhost1', port '5433', dbname 'demodb', work_mem '16MB');

CREATE SERVER

Not only CREATE SERVER statement but ALTER SERVER statement are also available.

postgres=# ALTER SERVER remsvr1 OPTIONS ( SET work_mem '32MB');

ALTER SERVER

postgres=# SELECT * FROM pg_foreign_server;

-[ RECORD 1 ]----------------------------------------------------------

srvname | remsvr1

srvowner | 10

srvfdw | 16389

srvtype |

srvversion |

srvacl |

srvoptions | {host=remhost1,port=5433,dbname=demodb,work_mem=32MB}

Within this patch, I implemented a change in GUC work_mem by specifying "options -c work_mem=value" for the PQconnectdbParams API function.

Best Regards,

Noriyoshi Shinoda

Attachment Content-Type Size
postgres_fdw_work_mem_v1.patch application/octet-stream 4.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2018-08-17 06:40:20 Re: TupleTableSlot abstraction
Previous Message Amit Khandekar 2018-08-17 06:00:49 Re: partitioning - changing a slot's descriptor is expensive