pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: ivanstepanovftw (@ivanstepanovftw) <noreply+ivanstepanovftw@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #704: Discussion: understanding pgvector
Date: Thu, 31 Oct 2024 15:15:05 +0000
Message-ID: <gh-pgvector-pgvector-704-c2450140289@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-704@github.com>
References: <gh-pgvector-pgvector-704@github.com>

I managed to rsync old database directory to the new server and run it.

As I inspect in hexdump, `pg_dump` with all "plain", "tar", "custop" and "directory" formats, dumps floats in vectors that are written as a **decimal** representation of IEEE 754 floating point, i.e. 0.1234 or 1.234e-1, and **not** in hexadecimal formats like 0x1.9p+6 or something like that. The rest "binary" formats are just gzipped, like "custom" and "directory". IEEE 754 32-bit floating point is not using decimal numbers, so not all floats may be represented in decimal base as a string because of math.

With "custom" format issue comes quickly - it gzips vectors, while they are not compressible with gzip. I got around 6 MiB/sec at peak, while db is like 100+ GB of embeddings.

You can try yourself that "custom" binary format and see that vectors are decimal string representation:
```shell
pg_dump -U user -p port -d database -h address -F custom --compress=none
```

However, I found that there is [`pg_dumpbinary`](https://www.postgresql.org/about/news/pg_dumpbinary-v27-2422/), but I did not found that command on Ubuntu 24.04 and decided just to rsync postgres folders to a new server.

---
Summary:

pg_dump loses precision, takes more memory or CPU, and is not optimal to use with pgvector.

pd_dumpbinary is a possible alternative, but untested.

view thread (9+ messages)  latest in thread

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