pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: Grunthos (@Grunthos) <noreply+Grunthos@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #963: Question: Binary initialisation
Date: Fri, 06 Mar 2026 04:49:53 +0000
Message-ID: <gh-pgvector-pgvector-963-c4009554353@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-963@github.com>
References: <gh-pgvector-pgvector-963@github.com>

Hi @ankane ,

Thanks for the prompt replies!

The problem with the above approach is the creation and destruction of massive strings (in my case vectors with in the worst case up up to 8k values). Mostly they are small.

The use case is as follows:

- We build arrays of what are basically attribute lists for objects.
  - This is our int[] parameter.
  - Those attribute lists are of varying length but consist of a list of integer IDs.
- We also have "weights" for those attributes stored/derived elsewhere; many objects share attributes so we weight them in one place and can easily generate a per-object list of weights based on the attributes.
  - This is our float[] parameter
 - Next we have a 'check' object that wants to compute a score based on members of the 'check' list based on the weights in the first list.
   - this is the motivation for the sparse array with a single value for all entries, in this case '1'
   - We anticipate a sparse dot product will work nicely.
 - The problem is building the sparse arrays dynamically. This will be done inside a single query executing across many rows.
   - We currently do this with a simple C function. It's fast and efficient.
   - We are moving the database to AWS Aurora and `pgvector` is present, but C language is not.

To my eye this looks like a natural fit for anyone who wants to build sparse vectors efficiently and looks like a good analogue for the dense vector constructor and would seem to have the same justification: strings are bad  ;-).



view thread (9+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-963-c4009554353@github.com>
Permalink:  ../gh-pgvector-pgvector-963-c4009554353@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