Prerequisites
Before you begin the installation process:
Install your flavor of Postgres if not already installed. See:
Set up the repository:
Setting up the repository is a one-time task. If you've already set up your repository, you don't need to perform this step.
To set up the repository, go to EDB repositories and follow the instructions provided there.
Hardware considerations for vector workloads
pgvector stores and operates on floating-point vectors in memory during index builds and queries. For production vector workloads:
Memory: HNSW index builds are memory-intensive. Set
maintenance_work_memto at least 1 GB before building indexes on large datasets (for example,SET maintenance_work_mem = '4GB'). Ensureshared_buffersis sized appropriately for your workload. To halve memory usage, consider using thehalfvectype instead ofvector— half-precision vectors store each dimension in 2 bytes instead of 4 and are supported by both HNSW and IVFFlat indexes. See the pgvector documentation for details.Storage: Vector columns consume significant disk space. A single 1536-dimension
vectorcolumn (as used by OpenAI embeddings) requires approximately 6 KB per row, so a table with 1 million rows requires roughly 6 GB for the vector column alone.CPU: Both HNSW and IVFFlat index scans are CPU-bound. CPUs with AVX-512 or AVX2 support benefit from hardware-accelerated distance calculations.
Installing the package
sudo dnf -y install edb-<postgres><postgres_version>-pgvector0
sudo zypper -y install edb-<postgres><postgres_version>-pgvector0
sudo apt-get -y install edb-<postgres><postgres_version>-pgvector-0
<postgres>is the distribution of Postgres you're using:Postgres distribution Value PostgreSQL pg EDB Postgres Advanced Server as EDB Postgres Extended Server postgresextended <postgres_version>is the version of Postgres you're using.
For example, to install pgvector for EDB Postgres Advanced Server 16 on a RHEL 9 platform:
sudo dnf -y install edb-as16-pgvector0
After installing, see Configuring pgvector to enable the extension in your database.