RE: [HACKERS] Proposal to add work_mem option to postgres_fdw module - Mailing list pgsql-hackers

From Shinoda, Noriyoshi (PN Japan GCS Delivery)
Subject RE: [HACKERS] Proposal to add work_mem option to postgres_fdw module
Date
Msg-id TU4PR8401MB0430B5DC93FFA78C72125E4BEE360@TU4PR8401MB0430.NAMPRD84.PROD.OUTLOOK.COM
Whole thread Raw
In response to [HACKERS] Proposal to add work_mem option to postgres_fdw module  ("Shinoda, Noriyoshi (PN Japan GCS Delivery)" <noriyoshi.shinoda@hpe.com>)
List pgsql-hackers
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-hackers@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
specifyis 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
PQconnectdbParamsAPI function. 

Best Regards,
Noriyoshi Shinoda


Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Windows vs C99 (was Re: C99 compliance for src/port/snprintf.c)
Next
From: Thomas Munro
Date:
Subject: Re: C99 compliance for src/port/snprintf.c