Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkPVX-0004me-Qe for pgsql-general@arkaria.postgresql.org; Thu, 06 Apr 2023 13:18:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pkPVV-0000OB-A3 for pgsql-general@arkaria.postgresql.org; Thu, 06 Apr 2023 13:18:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkPVU-0000Ni-RM for pgsql-general@lists.postgresql.org; Thu, 06 Apr 2023 13:18:28 +0000 Received: from mail-db5eur01olkn2075.outbound.protection.outlook.com ([40.92.64.75] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkPVN-0000lz-76 for pgsql-general@postgresql.org; Thu, 06 Apr 2023 13:18:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N2ba4Drl4u/MZYxa4TbatqrV/t/LYIPi5S3rVp/0SzijGQ7app8q55eiU73Kv+sMN9HXOYxPSQ0Nn6B9OS3qZ3I3w16kbqkAYMGFgocSfWSpunZqfh7VrnjbQ71Jy3SH250Y6ZHlr2rC7IlRflMwQPE8Zo9WIrTQzLk1vjSgPUbXeDGbxgY3KbzpxKp4SATvDO8Ug9mn766wIB6hkE3CtorHq6kbxMYe8c87O8L8aFNjBI6KNxU6JwKUNQw1+r+NI32O/wtOMBAt4dmVEW32B2FcjP4F06ZgJ3ZtjshsYH8o9XW1Le2K69SM73DGlE76Ns+FRD5jqhEovBXD8EegkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B8F1nG66nz0ig0Bo7IBgGgC/ExNSDpvXnYwmoL/jd4o=; b=QLBKO+RkLS2qBAQ8KR7flQG0GjXC5dqIPwHvdCg/G4ovhqVXUm0omCcTSvFebn1LkeLLxJcMdVmOuTJ70goPU09ZV0aURHKL/PyaKfkZVrb0ol8JZG40JRaurx+JNJAb9elgLzGysPCDS7VaIK/bM5Q9CE3rNyDg7lNJ0dwpAns/jkoafL57uMH31hhlZy4VmWdoGTTJozShnxselLMNFbi6PWGe/lioStlcXY0GlqaGBzz5dHIMfDy/o5Y2wWneRWl1BFjzCSe94pS65faH6yOdK79oa/i+H3qOBwJVpTDElKJN7oqgKpd9wfUE5xh8jgTyK0NbCSQrRyGrvoZxOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from PA4PR10MB5516.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:271::10) by PAXPR10MB5781.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:247::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.29; Thu, 6 Apr 2023 13:18:17 +0000 Received: from PA4PR10MB5516.EURPRD10.PROD.OUTLOOK.COM ([fe80::cf54:d7e2:68e8:398c]) by PA4PR10MB5516.EURPRD10.PROD.OUTLOOK.COM ([fe80::cf54:d7e2:68e8:398c%7]) with mapi id 15.20.6277.026; Thu, 6 Apr 2023 13:18:17 +0000 From: Marco Fortina To: Stephen Frost CC: "pgsql-general@postgresql.org" Subject: R: Proposal: Shared Work Mem Area Thread-Topic: Proposal: Shared Work Mem Area Thread-Index: AQHZaIlGRISnvq/vekS2xNoHmeU6Wg== Date: Thu, 6 Apr 2023 13:18:17 +0000 Message-ID: Accept-Language: it-IT, en-US Content-Language: it-IT X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-tmn: [ZH8VxxcWLKpJLR4cKYWIx8QNqJEbz/1s] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR10MB5516:EE_|PAXPR10MB5781:EE_ x-ms-office365-filtering-correlation-id: 71ec7de5-3a96-48b4-e15d-08db36a162a8 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DGEH69jIybaF69jkiK7Ukwm9GgtL75SJpn9lbM6Dzscp/kmoDgX8/0temhaJXPhf+GhaWkJvwnEfCcs0W7HZGWyUgDusD0rQ7Dr/zMSWns0maPYKXwprC0unA8uCW/Ln1+6Qe2Oti+N4yNE0/YPwj+Em4HZf81rttoQoeZWbFjX8cktaeiXApmUOeteJIbZI5WiSc53XjSd5c7ihlN856MrFGulVrpdkOM2+TQ0yQ+srfxpS7saMOkVvpPsDAUWNOyhd5N5zClzfbWBrdQo9vpXLOZ1jhG/E/2TTIRqoV/m4Gs+en7Y6lr/pEj+mGOCUR3in/eDXpxo2hlcmwhQyUjiJ3qy0wqlqAxfQBcNm8MstCKMe0VXtGHajsOw4fEfPLjTuEGMDCsDyiWlRSaKUmvGE1wRMn7Pbtslg4+nlh6jRvyqMmLwm5shCaNAd8BOX6lvaL25nAWgaDE+001GiVKEjTHVobChEtADG1HIOl4GJsuIdybLWMyn16c8dk4a425MSXaotfq3HZOP0w4hpHajfC5JQrD6UdNb6TV3CjpZZM0ro4tEULo8CainvKTrOFMVCtqQ75DnaVMqVKGpasWBNBPM+WCII2jN7cxw3zs4= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?gk2Whk3OP/gb2QytwAmV6aru5yg3t4qX/82fP0lPG2ykgIgmvJKZwwY21z?= =?iso-8859-1?Q?80TZu2sSlTaf5dlX/KchZBD6G2DpHhW+jEjZVYjygx3+twHn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8DarfiSh09YlYk/m0Oh2xDKC3BvC5YJfNCU1WUFOTIJ1?= =?iso-8859-1?Q?KI4lWtP548gPPCYOVxAT5SeqDCFhVtRb6wEtaazvukVISZLv7PDCgwP542?= =?iso-8859-1?Q?+h4kCU3bIpcpGZZBPgvP0zA6D7RPccAT7zWZ32IxRQSctp1zrU7M84F5Sf?= =?iso-8859-1?Q?U2Z2r0i6/4n6Nd0Q7FX+hpxA07vC1HKc1HvGtiwx1akFeFUm8uUHuXGXsQ?= =?iso-8859-1?Q?AZijF3eKdtVhKLH+H6tow4jfmk3r3CfWGGwiufdNhpAAoNRPhVyr5rNUjQ?= =?iso-8859-1?Q?EbMRgx6oGUdOAmwsJTHg=3D=3D?= Content-Type: multipart/alternative; boundary="_000_PA4PR10MB5516E4AF81ADE3E4BA602BC9F7919PA4PR10MB5516EURP_" MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6b909.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR10MB5516.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 71ec7de5-3a96-48b4-e15d-08db36a162a8 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Apr 2023 13:18:17.5538 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR10MB5781 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_PA4PR10MB5516E4AF81ADE3E4BA602BC9F7919PA4PR10MB5516EURP_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thanks Stephen. https://commitfest.postgresql.org/42/3867/ is not exacly what I proposed as= new feature to developers. If I'm not wrong, almost all main memory areas have a fixed size: shared_buffers effective_cache_size wal_buffers Instead, work_mem is per-process dynamically allocated up to defined size l= imit. What I suggested is to replace work_mem from per-process allocation to glob= al and fixed size allocation (see pga_aggregate_target on Oracle) and share= d to worker processes. Let's assume the new parameter name is worker_mem_area and this was set to = 8GB: with my proposal method each worker process do not use it's own dedica= ted work_mem but the shared one. In this way each worker is also able to peek free pages from the worker_mem= _area if needed. Regards, Marco ________________________________ Da: Stephen Frost Inviato: Gioved=EC, 06 Aprile, 2023 14:43 A: Marco Fortina Cc: pgsql-general@postgresql.org Oggetto: Re: Proposal: Shared Work Mem Area Greetings, * Marco Fortina (marco_fortina@hotmail.it) wrote: > I would like to propose to developers a new feature to replace the privat= e management of the work mem with a management through shared memory: alloc= ated at the start of PostgreSQL this area should be shared to all worker pr= ocesses as for example Oracle Database PGA do. > > This would allow an optimal use of this memory area by limiting only its = global maximum limit and not a configuration/allocation at the process leve= l. > > What do you think about my proposal? There's ongoing work to provide a way to have a global maximum limit which doesn't involve entirely reworking how work_mem works today. The commitfest entry for that work is here: https://commitfest.postgresql.org/42/3867/ If you're interested in that, getting additional reviews and comments on the work would be helpful in moving it forward. Thanks, Stephen --_000_PA4PR10MB5516E4AF81ADE3E4BA602BC9F7919PA4PR10MB5516EURP_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Thanks Stephen.
https://commitfest.postgresql.org/42/3= 867/ is not exacly what I proposed as new feature to developers. 
 
If I'm not wrong, almost all main memory areas have a fixed size: 

shared_buffers
effective= _cache_size
wal_buffe= rs

Instead, work_mem is per-process dynamically allocated up to defined size l= imit.

What I suggested is to replace work_mem from per-process allocation to glob= al and fixed size allocation (see pga_aggregate_target on Oracle) and shared to worker processes. 

Let's assume the new parameter name is worker_mem_area and this was set to = 8GB: with my proposal method each worker process do not use it's own dedica= ted work_mem but the shared one. 

In this way each worker is also able to peek free pages from the worker_mem_area if needed.

Regards,=
Marco





Da: Stephen Frost
Inviato: Gioved=EC, 06 Aprile, 2023 14:43
A: Marco Fortina
Cc: pgsql-general@postgresql.org
Oggetto: Re: Proposal: Shared Work Mem Area

Greetings,

* Marco Fortina (marco_fortina@hotmail.it) wrote:
> I would like to propose to developers a new feature to replace the pri= vate management of the work mem with a management through shared memory: al= located at the start of PostgreSQL this area should be shared to all worker= processes as for example Oracle Database PGA do.
>
> This would allow an optimal use of this memory area by limiting only i= ts global maximum limit and not a configuration/allocation at the process l= evel.
>
> What do you think about my proposal?

There's ongoing work to provide a way to have a global maximum limit
which doesn't involve entirely reworking how work_mem works today.  Th= e
commitfest entry for that work is here:

https://commitfest.po= stgresql.org/42/3867/

If you're interested in that, getting additional reviews and comments on the work would be helpful in moving it forward.

Thanks,

Stephen
--_000_PA4PR10MB5516E4AF81ADE3E4BA602BC9F7919PA4PR10MB5516EURP_--