RE: [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: RE: [HACKERS] Proposal to add work_mem option to postgres_fdw module
Date: 2018-08-24 02:30:54
Message-ID: TU4PR8401MB0430B5DC93FFA78C72125E4BEE360@TU4PR8401MB0430.NAMPRD84.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)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 Content-Type Size
postgres_fdw_work_mem_v2.patch application/octet-stream 5.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-08-24 02:36:51 Re: C99 compliance for src/port/snprintf.c
Previous Message Thomas Munro 2018-08-24 02:25:27 Re: Windows vs C99 (was Re: C99 compliance for src/port/snprintf.c)