pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
16+ messages / 3 participants
[nested] [flat]

* [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-09 06:17  "schuemie (@schuemie)" <noreply+schuemie@github.com>
  0 siblings, 0 replies; 16+ messages in thread

From: schuemie (@schuemie) @ 2024-09-09 06:17 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

On Windows, `maintenance_work_mem` cannot be bigger than 2GB, something that is [poorly documented](https://postgrespro.com/list/thread-id/2609309). Because of this, building indices is prohibitively slow for larger vector stores.

In order for others not to have to find this out the hard way like I did, I propose adding a small note to the README that warns people of this. Maybe something like this:
```
NOTE: On Windows, `maintenance_work_mem` is currently limited to 2,024MB at most(up to and including PostgreSQL 16). It might therefore take a prohibitively long time to build indices for large vector stores. 
```

Documenting my experience: I created 37 million vectors (PubMed) of 384 dimensions. Loading them in pgvector using bulk loading was quick (< 2 hours). But when I run
```sql
SET maintenance_work_mem = '2047MB'
SET max_parallel_maintenance_workers = 16
CREATE INDEX ON pubmed.vectors_snowflake_arctic_s USING hnsw (embedding vector_cosine_ops)
```
After running for 65 hours, progress is at 74.5%, which is 1% higher than it was 24 hours ago.

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-09 07:15  "ankane (@ankane)" <noreply+ankane@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: ankane (@ankane) @ 2024-09-09 07:15 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @schuemie, thanks for sharing. Will figure out how to document. You could try using Docker or WSL 2 to get around this.

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-11 16:16  "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: VladlenPopolitov (@VladlenPopolitov) @ 2024-09-11 16:16 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @schuemie .
This link ['poorly documented'](https://postgrespro.com/list/thread-id/2609309) had misinterpreted information and it  was not answered. maintenance_work_mem variable really has limits from 1024 to 2097151, but these values are in KB.
It has less range in Postgres in all 32-bit OS-es, not only Windows (range from 1024 to 2097151/1024). 32-bit Windows application can address up to 4Gb, splitted by 2GB allocated to system usage, and 2 GB allocated to application. In any case application cannot get more than 2Gb.
64bit Windows works the same way as other 64 bit OS-es, and PostgreSQL source code does not have any 2GB limit for Windows in this case.
Author of above link misunderstood the meaning of values, and everyone politely kept silence and did not pointed to his mistake.
PostgreSQL allows to allocate all application memory for maintenance_work_mem, but not more, than 2048Gb.

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-11 18:54  "ankane (@ankane)" <noreply+ankane@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: ankane (@ankane) @ 2024-09-11 18:54 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @VladlenPopolitov, the limit still applies to 64-bit Windows.

```sql
ERROR: 2097152 kB is outside the valid range for parameter "maintenance_work_mem" (1024 .. 2097151)
```

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-11 21:17  "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: VladlenPopolitov (@VladlenPopolitov) @ 2024-09-11 21:17 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane Correct! If compiled by MSVC, then compiler uses sizeof(long)==4
#if SIZEOF_SIZE_T > 4 && SIZEOF_LONG > 4

It looks like Cygwin only has sizeof(long)==8 in Windows-x64.

And reason for this strange behaviour - some variables in Postgres code that use work_mem variables values are declared as long instead of int64. 

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-11 21:47  "ankane (@ankane)" <noreply+ankane@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: ankane (@ankane) @ 2024-09-11 21:47 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Yeah, I looked into this briefly to see if it's something that could be addressed (since it could really help here), but based on this comment - `/* note that various places assume the byte size fits in a "long" variable */` - didn't have high confidence about figuring out all of the places (the [relevant commit](https://github.com/postgres/postgres/commit/85d02a6586012edc385a420ebaca1c8ce4e93390) is from 2009).

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-16 08:25  "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: VladlenPopolitov (@VladlenPopolitov) @ 2024-09-16 08:25 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane it could be fixed in future version of PostgreSQL, but now in current and previous PostgreSQL versions you could use other solution: maintenance_work_mem is used to inform the system by the user how much memory to use during index build. You can add additional GUC variable like pgvector_build_mem (0 by default). If it has value more than 0, then user asked to use this value for memory consumption instead maintenance_work_mem. It is more reliable, than patch future PostgreSQL versions.

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-19 14:15  "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: VladlenPopolitov (@VladlenPopolitov) @ 2024-09-19 14:15 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane @schuemie   Hi! I did patch to fix this issue in PostgreSQL master and sent it to pgsql-hackers [patch-mail](https://www.postgresql.org/message-id/1a01f0-66ec2d80-3b-68487680%4027595217). It would be good to support the importance of this patch.

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-19 20:55  "ankane (@ankane)" <noreply+ankane@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: ankane (@ankane) @ 2024-09-19 20:55 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Awesome, big thanks @VladlenPopolitov!

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-20 03:23  "schuemie (@schuemie)" <noreply+schuemie@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: schuemie (@schuemie) @ 2024-09-20 03:23 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Thank you @VladlenPopolitov! How can I help support?

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2024-09-20 14:37  "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: VladlenPopolitov (@VladlenPopolitov) @ 2024-09-20 14:37 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@schuemie If you even write answer in mail list, that you need this feature and waited it, it would be good. The vector search is not wide spread among the community yet, it could be considered as something unimportant .

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2025-02-01 05:50  "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: VladlenPopolitov (@VladlenPopolitov) @ 2025-02-01 05:50 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane @schuemie patch commited. PostgreSQL 18 under Windows will have 2TB maintenance_work_mem limit instead of 2Gb. [https://commitfest.postgresql.org/51/5343/](https://commitfest.postgresql.org/51/5343/)

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2025-02-02 20:13  "ankane (@ankane)" <noreply+ankane@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: ankane (@ankane) @ 2025-02-02 20:13 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

This is great, thanks @VladlenPopolitov!

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2025-02-03 10:58  "schuemie (@schuemie)" <noreply+schuemie@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: schuemie (@schuemie) @ 2025-02-03 10:58 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Wow! Awesome! Thank you @VladlenPopolitov 

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2025-09-26 03:51  "ankane (@ankane)" <noreply+ankane@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: ankane (@ankane) @ 2025-09-26 03:51 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Postgres 18 is now released 🎉 so closing this out.

^ permalink  raw  [nested|flat] 16+ messages in thread

* Re: [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows
@ 2025-09-26 03:51  "ankane (@ankane)" <noreply+ankane@github.com>
  14 siblings, 0 replies; 16+ messages in thread

From: ankane (@ankane) @ 2025-09-26 03:51 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 16+ messages in thread


end of thread, other threads:[~2025-09-26 03:51 UTC | newest]

Thread overview: 16+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-09 06:17 [pgvector/pgvector] issue #667: Please add a note to README warning of limitations on Windows "schuemie (@schuemie)" <noreply+schuemie@github.com>
2024-09-09 07:15 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-09-11 16:16 ` "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
2024-09-11 18:54 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-09-11 21:17 ` "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
2024-09-11 21:47 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-09-16 08:25 ` "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
2024-09-19 14:15 ` "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
2024-09-19 20:55 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-09-20 03:23 ` "schuemie (@schuemie)" <noreply+schuemie@github.com>
2024-09-20 14:37 ` "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
2025-02-01 05:50 ` "VladlenPopolitov (@VladlenPopolitov)" <noreply+VladlenPopolitov@github.com>
2025-02-02 20:13 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-02-03 10:58 ` "schuemie (@schuemie)" <noreply+schuemie@github.com>
2025-09-26 03:51 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-09-26 03:51 ` "ankane (@ankane)" <noreply+ankane@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox