Increase of maintenance_work_mem limit in 64-bit Windows

From: Пополитов Владлен <v(dot)popolitov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Increase of maintenance_work_mem limit in 64-bit Windows
Date: 2024-09-19 13:55:42
Message-ID: 1a01f0-66ec2d80-3b-68487680@27595217
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!
Currently PostgreSQL built on 64-bit Windows has 2Gb limit for
GUC variables due to sizeof(long)==4 used by Windows compilers.
Technically 64-bit addressing for maintenance_work_mem is possible,
but code base historically uses variables and constants of type "long",
when process maintenance_work_mem value.
Modern vector indexes like pgvector or pgvectorscale require as much
as possible maintenance_work_mem, 2 Gb limit  dramatically decrease
build index performace making impossible to build indexes for large
datasets.
​​​ The proposed patch fixes all appearences of "long" variables and constants
that can affect maintenance_work_mem (hash index, vacuum, planner only
affected, gin, gist, brin, bloom, btree indexes process value
correctly).
Constant MAX_SIZE_T_KILOBYTES added as upper limit for GUC variables
that depend on size_t only (currently only maintenance_work_mem).
Other GUC variables could use this constant after fixing "long" type
dependence.
This patch tested on
a) Windows 10 64-bit AMD64, compiled by msvc-19.37.32822
b) linux gcc (Debian 12.2.0-14) AMD64
All tests are passed.

Best regards

Vladlen Popolitov
postgrespro.com

 

Attachment Content-Type Size
v1-0001-maintenance_work_mem-limit-increased-in-64-bit-Wi.patch application/octet-stream 4.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message torikoshia 2024-09-19 14:16:47 Re: Add on_error and log_verbosity options to file_fdw
Previous Message Robert Haas 2024-09-19 13:25:05 Re: pgsql: Don't enter parallel mode when holding interrupts.