Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
63792c8
Implement AVX512 distance calculations for halfvec
lucagiac81 Apr 9, 2024
5969951
Automate fp16/fp32 halfvec distance computation
lucagiac81 Sep 25, 2024
49fa02b
Implement AVX512 vector_to_halfvec conversion
lucagiac81 Oct 28, 2024
80049e4
Add CI job for AVX512 FP16 optimized path
lucagiac81 Nov 27, 2024
bfaa33a
Move AVX-512 functions to separate files
lucagiac81 Mar 25, 2025
5655669
Added note about index options to index build time docs - #807 [skip ci]
ankane Mar 26, 2025
69d03ba
Added fields to IndexAmRoutine for Postgres 18 [skip ci]
ankane Apr 5, 2025
ad6baf4
Fixed warnings with Postgres 18 [skip ci]
ankane Apr 5, 2025
de5857d
Improved warning check [skip ci]
ankane Apr 5, 2025
3d59493
Revert "Fixed warnings with Postgres 18 [skip ci]"
ankane Apr 5, 2025
af3a482
Fixed CI for Postgres 18 [skip ci]
ankane Apr 5, 2025
c2544d2
Updated readme [skip ci]
ankane Apr 13, 2025
7c96bbb
Updated readme [skip ci]
ankane May 7, 2025
23ffa72
Updated readme [skip ci]
ankane May 12, 2025
ee12fbd
Updated Windows installation instructions - #593 [skip ci]
ankane Jun 4, 2025
fc99a01
Updated readme [skip ci]
ankane Jun 4, 2025
d40a22f
Set random seed for IVFFLAT_BENCH [skip ci]
ankane Jun 18, 2025
fc7a8e8
vectorize: optimize VectorSumCenter and HalfvecSumCenter (#860)
binarycleric Jun 18, 2025
bb2dc96
Ran pgindent [skip ci]
ankane Jun 18, 2025
19ae89c
Fixed CI [skip ci]
ankane Jun 18, 2025
95d7cc4
Improved variable names [skip ci]
ankane Jun 19, 2025
61b00f0
Vectorizing vector_concat for improved performance (#861)
binarycleric Jun 19, 2025
ec0138f
Ran pgindent [skip ci]
ankane Jun 19, 2025
505831a
Updated link [skip ci]
ankane Jul 1, 2025
8a2d502
Fixed relaxed results example for Postgres 17 - #862 [skip ci]
ankane Jul 1, 2025
096c706
Updated readme [skip ci]
ankane Jul 1, 2025
db8f3bf
Synced .dockerignore with .gitignore [skip ci]
ankane Jul 9, 2025
2b169b5
Added OS to Dockerfile [skip ci]
ankane Jul 9, 2025
ac8f7ed
Revert "Added OS to Dockerfile [skip ci]"
ankane Jul 10, 2025
6de9282
Updated Dockerfile to use release [skip ci]
ankane Jul 27, 2025
3c33deb
Added Docker images with -bookworm suffix [skip ci]
ankane Jul 27, 2025
4f1f47c
Updated changelog [skip ci]
ankane Jul 27, 2025
940961d
Added supported Docker tags to readme [skip ci]
ankane Jul 27, 2025
60d17ba
Use consistent style [skip ci]
ankane Jul 28, 2025
636ab9b
Added Postgres 19 to CI [skip ci]
ankane Jul 28, 2025
7c6a90b
Switched to PG_MODULE_MAGIC_EXT for Postgres 18+ [skip ci]
ankane Aug 1, 2025
b5dc0cc
Updated FreeBSD package name in readme [skip ci]
ankane Aug 9, 2025
b2e441e
Ran pgindent [skip ci]
ankane Aug 19, 2025
8c5bbdd
Add autovectorized implementation of binary quantize
lucagiac81 Aug 13, 2025
8762819
Improved performance of binary_quantize function for halfvec
ankane Aug 19, 2025
a6109ad
Updated comment [skip ci]
ankane Aug 19, 2025
a94212c
Use NIL for empty lists (#890)
rjuju Aug 23, 2025
b7ad676
Added Docker images for Debian 13 / Trixie [skip ci]
ankane Aug 24, 2025
a899288
Added new Docker images to readme [skip ci]
ankane Aug 24, 2025
fc47ad8
Reordered supported Docker tags [skip ci]
ankane Aug 24, 2025
4bd530a
Added another test for binary_quantize function [skip ci]
ankane Aug 29, 2025
429c365
Updated changelog [skip ci]
ankane Sep 4, 2025
e1146d4
Fixed compilation error with Postgres 19
ankane Sep 4, 2025
b02ed17
Version bump to 0.8.1 [skip ci]
ankane Sep 5, 2025
c6c38de
Added windows-2025 to CI [skip ci]
ankane Sep 5, 2025
b0d989b
Updated CI [skip ci]
ankane Sep 6, 2025
04f3ea2
Test with macos-15-intel on CI [skip ci]
ankane Sep 20, 2025
6c8d318
Updated CI [skip ci]
ankane Sep 20, 2025
0e8b7c4
Updated checkout action [skip ci]
ankane Sep 22, 2025
5d70fe2
Updated readme for Postgres 18 [skip ci]
ankane Sep 25, 2025
3bb30ed
Updated CI for Postgres 18 [skip ci]
ankane Sep 25, 2025
410a616
Updated style to be consistent with Mac [skip ci]
ankane Sep 25, 2025
85fb52e
Added Docker images for Postgres 18 [skip ci]
ankane Sep 26, 2025
615becc
Updated readme [skip ci]
ankane Sep 26, 2025
990b247
Removed unused parameters [skip ci]
ankane Sep 27, 2025
e115349
Removed unused parameter [skip ci]
ankane Sep 27, 2025
2393c55
Fixed Index Searches in EXPLAIN output for Postgres 18
ankane Oct 22, 2025
80027b6
Added varatt headers for Postgres 16+
ankane Oct 22, 2025
832b4b7
Updated readme [skip ci]
ankane Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .dockerignore

This file was deleted.

72 changes: 57 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
fail-fast: false
matrix:
include:
- postgres: 19
os: ubuntu-24.04
- postgres: 18
os: ubuntu-24.04
- postgres: 17
Expand All @@ -21,14 +23,14 @@ jobs:
- postgres: 13
os: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ankane/setup-postgres@v1
with:
postgres-version: ${{ matrix.postgres }}
dev-files: true
- run: make
env:
PG_CFLAGS: -DUSE_ASSERT_CHECKING -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare
PG_CFLAGS: -DUSE_ASSERT_CHECKING -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare ${{ matrix.postgres >= 18 && '-Wno-missing-field-initializers' || '' }}
- run: |
export PG_CONFIG=`which pg_config`
sudo --preserve-env=PG_CONFIG make install
Expand All @@ -39,25 +41,57 @@ jobs:
sudo apt-get update
sudo apt-get install libipc-run-perl
- run: make prove_installcheck
ubuntu_spr:
runs-on: ubuntu-24.04
if: ${{ !startsWith(github.ref_name, 'mac') && !startsWith(github.ref_name, 'windows') }}
steps:
- uses: actions/checkout@v4
- name: Install Intel SDE
run: |
curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/831748/sde-external-9.44.0-2024-08-22-lin.tar.xz
mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
- name: Install Postgres
run: |
sudo apt-get install postgresql-16
sudo apt-get install postgresql-server-dev-16
sudo systemctl stop postgresql
pgdir=$(pg_config --bindir)
pgdata=/tmp/postgres_data
mkdir $pgdata
$pgdir/initdb -D $pgdata --username=$USER
sudo chmod 777 /var/run/postgresql/
sde -spr -mix -- $pgdir/pg_ctl -D $pgdata start
- run: make
env:
PG_CFLAGS: -DUSE_ASSERT_CHECKING -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare
- run: |
export PG_CONFIG=`which pg_config`
sudo --preserve-env=PG_CONFIG make install
- run: sde -spr -mix -- make installcheck
- if: ${{ failure() }}
run: cat regression.diffs
- name: Report AVX512 FP16 FMA instruction count
run: cat sde*.txt | grep -E "FMA.*PH"
mac:
runs-on: ${{ matrix.os }}
if: ${{ !startsWith(github.ref_name, 'windows') }}
strategy:
fail-fast: false
matrix:
include:
- postgres: 17
os: macos-15
- postgres: 18
os: macos-26
- postgres: 14
os: macos-13
os: macos-15-intel
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ankane/setup-postgres@v1
with:
postgres-version: ${{ matrix.postgres }}
- run: make
env:
PG_CFLAGS: -DUSE_ASSERT_CHECKING -Wall -Wextra -Werror -Wno-unused-parameter
PG_CFLAGS: -DUSE_ASSERT_CHECKING -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-warning-option ${{ matrix.postgres >= 18 && '-Wno-missing-field-initializers' || '' }}
- run: make install
- run: make installcheck
- if: ${{ failure() }}
Expand All @@ -70,27 +104,35 @@ jobs:
tar xf $TAG.tar.gz
mv postgres-$TAG postgres
env:
TAG: ${{ matrix.postgres == 17 && 'REL_17_2' || 'REL_14_15' }}
TAG: ${{ matrix.postgres == 18 && 'REL_18_0' || 'REL_14_19' }}
- run: make prove_installcheck PROVE_FLAGS="-I ./postgres/src/test/perl -I ./test/perl"
env:
PERL5LIB: /Users/runner/perl5/lib/perl5
- run: make clean && $(brew --prefix llvm@$LLVM_VERSION)/bin/scan-build --status-bugs make
env:
LLVM_VERSION: ${{ matrix.os == 'macos-15' && 18 || 15 }}
LLVM_VERSION: ${{ matrix.os == 'macos-26' && 20 || 18 }}
PG_CFLAGS: -DUSE_ASSERT_CHECKING
windows:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
if: ${{ !startsWith(github.ref_name, 'mac') }}
strategy:
fail-fast: false
matrix:
include:
- postgres: 17
os: windows-2025
- postgres: 14
os: windows-2022
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ankane/setup-postgres@v1
with:
postgres-version: 14
postgres-version: ${{ matrix.postgres }}
- run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" && ^
nmake /NOLOGO /F Makefile.win && ^
nmake /NOLOGO /F Makefile.win install && ^
nmake /NOLOGO /F Makefile.win installcheck && ^
nmake /NOLOGO /F Makefile.win installcheck ${{ matrix.postgres != 17 && 'PG_REGRESS=$(PGROOT)\bin\pg_regress' || '' }} && ^
nmake /NOLOGO /F Makefile.win clean && ^
nmake /NOLOGO /F Makefile.win uninstall
shell: cmd
Expand Down Expand Up @@ -123,10 +165,10 @@ jobs:
if: ${{ !startsWith(github.ref_name, 'mac') && !startsWith(github.ref_name, 'windows') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: ankane/setup-postgres-valgrind@v1
with:
postgres-version: 17
postgres-version: 18
check-ub: yes
- run: make OPTFLAGS=""
- run: sudo --preserve-env=PG_CONFIG make install
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 0.8.2 (unreleased)

- Fixed `Index Searches` in `EXPLAIN` output for Postgres 18

## 0.8.1 (2025-09-04)

- Added support for Postgres 18 rc1
- Improved performance of `binary_quantize` function

## 0.8.0 (2024-10-30)

- Added support for iterative index scans
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# syntax=docker/dockerfile:1

ARG PG_MAJOR=17
FROM postgres:$PG_MAJOR
ARG DEBIAN_CODENAME=bookworm
FROM postgres:$PG_MAJOR-$DEBIAN_CODENAME
ARG PG_MAJOR

COPY . /tmp/pgvector
ADD https://github.com/pgvector/pgvector.git#v0.8.1 /tmp/pgvector

RUN apt-get update && \
apt-mark hold locales && \
Expand Down
4 changes: 2 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vector",
"abstract": "Open-source vector similarity search for Postgres",
"description": "Supports L2 distance, inner product, and cosine distance",
"version": "0.8.0",
"version": "0.8.1",
"maintainer": [
"Andrew Kane <andrew@ankane.org>"
],
Expand All @@ -20,7 +20,7 @@
"vector": {
"file": "sql/vector.sql",
"docfile": "README.md",
"version": "0.8.0",
"version": "0.8.1",
"abstract": "Open-source vector similarity search for Postgres"
}
},
Expand Down
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
EXTENSION = vector
EXTVERSION = 0.8.0
EXTVERSION = 0.8.1

MODULE_big = vector
DATA = $(wildcard sql/*--*--*.sql)
DATA_built = sql/$(EXTENSION)--$(EXTVERSION).sql
OBJS = src/bitutils.o src/bitvec.o src/halfutils.o src/halfvec.o src/hnsw.o src/hnswbuild.o src/hnswinsert.o src/hnswscan.o src/hnswutils.o src/hnswvacuum.o src/ivfbuild.o src/ivfflat.o src/ivfinsert.o src/ivfkmeans.o src/ivfscan.o src/ivfutils.o src/ivfvacuum.o src/sparsevec.o src/vector.o
ifneq ($(USE_AVX512), 0)
OBJS += src/halfutils_avx512.o
endif
HEADERS = src/halfvec.h src/sparsevec.h src/vector.h

TESTS = $(wildcard test/sql/*.sql)
Expand All @@ -31,6 +34,9 @@ endif
# - GCC (needs -ftree-vectorize OR -O3) - https://gcc.gnu.org/projects/tree-ssa/vectorization.html
# - Clang (could use pragma instead) - https://llvm.org/docs/Vectorizers.html
PG_CFLAGS += $(OPTFLAGS) -ftree-vectorize -fassociative-math -fno-signed-zeros -fno-trapping-math
ifneq ($(USE_AVX512), 0)
PG_CFLAGS += -DUSE_AVX512
endif

# Debug GCC auto-vectorization
# PG_CFLAGS += -fopt-info-vec
Expand Down Expand Up @@ -76,4 +82,9 @@ docker:
.PHONY: docker-release

docker-release:
docker buildx build --push --pull --no-cache --platform linux/amd64,linux/arm64 --build-arg PG_MAJOR=$(PG_MAJOR) -t pgvector/pgvector:pg$(PG_MAJOR) -t pgvector/pgvector:$(EXTVERSION)-pg$(PG_MAJOR) .
docker buildx build --push --pull --no-cache --platform linux/amd64,linux/arm64 --build-arg PG_MAJOR=$(PG_MAJOR) --build-arg DEBIAN_CODENAME=bookworm -t pgvector/pgvector:pg$(PG_MAJOR) -t pgvector/pgvector:pg$(PG_MAJOR)-bookworm -t pgvector/pgvector:$(EXTVERSION)-pg$(PG_MAJOR) -t pgvector/pgvector:$(EXTVERSION)-pg$(PG_MAJOR)-bookworm .

.PHONY: docker-release-trixie

docker-release-trixie:
docker buildx build --push --pull --no-cache --platform linux/amd64,linux/arm64 --build-arg PG_MAJOR=$(PG_MAJOR) --build-arg DEBIAN_CODENAME=trixie -t pgvector/pgvector:pg$(PG_MAJOR)-trixie -t pgvector/pgvector:$(EXTVERSION)-pg$(PG_MAJOR)-trixie .
7 changes: 5 additions & 2 deletions Makefile.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTENSION = vector
EXTVERSION = 0.8.0
EXTVERSION = 0.8.1

DATA_built = sql\$(EXTENSION)--$(EXTVERSION).sql
OBJS = src\bitutils.obj src\bitvec.obj src\halfutils.obj src\halfvec.obj src\hnsw.obj src\hnswbuild.obj src\hnswinsert.obj src\hnswscan.obj src\hnswutils.obj src\hnswvacuum.obj src\ivfbuild.obj src\ivfflat.obj src\ivfinsert.obj src\ivfkmeans.obj src\ivfscan.obj src\ivfutils.obj src\ivfvacuum.obj src\sparsevec.obj src\vector.obj
Expand Down Expand Up @@ -31,6 +31,9 @@ LIBDIR = $(PGROOT)\lib
PKGLIBDIR = $(PGROOT)\lib
SHAREDIR = $(PGROOT)\share

# Use $(PGROOT)\bin\pg_regress for Postgres < 17
PG_REGRESS = $(LIBDIR)\pgxs\src\test\regress\pg_regress

CFLAGS = /nologo /I"$(INCLUDEDIR_SERVER)\port\win32_msvc" /I"$(INCLUDEDIR_SERVER)\port\win32" /I"$(INCLUDEDIR_SERVER)" /I"$(INCLUDEDIR)"

CFLAGS = $(CFLAGS) $(PG_CFLAGS)
Expand Down Expand Up @@ -58,7 +61,7 @@ install: all
for %f in ($(HEADERS)) do copy %f "$(INCLUDEDIR_SERVER)\extension\$(EXTENSION)"

installcheck:
"$(BINDIR)\pg_regress" --bindir="$(BINDIR)" $(REGRESS_OPTS) $(REGRESS)
"$(PG_REGRESS)" --bindir="$(BINDIR)" $(REGRESS_OPTS) $(REGRESS)

uninstall:
del /f "$(PKGLIBDIR)\$(SHLIB)"
Expand Down
Loading