Hi, Hackers.

I updated the patch that I attached the other day.
Added release of dynamically allocated memory and modified source according to 
coding rule.

Regards,
Noriyoshi Shinoda
--
From: Shinoda, Noriyoshi (PN Japan GCS Delivery) 
Sent: Friday, August 17, 2018 3:07 PM
To: pgsql-hack...@postgresql.org
Subject: [HACKERS] Proposal to add work_mem option to postgres_fdw module

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: postgres_fdw_work_mem_v2.patch
Description: postgres_fdw_work_mem_v2.patch

Reply via email to