Database / pgvector basics Interview Questions
How do you install and enable pgvector in PostgreSQL?
pgvector installation has two steps: installing the extension binary on the server, and enabling it in each database where you want to use it. The extension name used in SQL is vector (not pgvector).
| Method | Command |
|---|---|
| Ubuntu/Debian (PostgreSQL APT repo) | sudo apt install postgresql-17-pgvector |
| RHEL/CentOS (Yum repo) | sudo yum install pgvector_17 |
| macOS (Homebrew) | brew install pgvector |
| Docker | Use pgvector/pgvector Docker image |
| Conda | conda install -c conda-forge pgvector |
| From source | git clone + make + make install |
| Managed (AWS RDS, Supabase, Neon, Azure) | Enable via console or allowlist |
-- Step 1: Enable in the database (run once per database) CREATE EXTENSION vector; -- Verify it is installed: SELECT * FROM pg_extension WHERE extname = 'vector'; -- Upgrade an existing installation: ALTER EXTENSION vector UPDATE; -- On managed services (e.g. Azure), allowlist it first: -- Then CREATE EXTENSION vector; in the database -- Build from source (Linux): -- git clone --branch v0.8.4 https://github.com/pgvector/pgvector.git -- cd pgvector && make && sudo make install -- Then in psql: CREATE EXTENSION vector;
Important naming note: although the project is universally called pgvector, the PostgreSQL extension name is vector. Always use CREATE EXTENSION vector (not pgvector). This distinction matters on managed services like Azure where you must allowlist the name vector.
More Related questions...