Compare commits

...

15 Commits

Author SHA1 Message Date
Andrew Kane
69672cd84d Version bump to 0.4.2 [skip ci] 2023-05-13 20:47:40 -07:00
Andrew Kane
300adba2f1 Updated messages 2023-05-13 20:44:46 -07:00
Andrew Kane
e362279199 Updated changelog [skip ci] 2023-05-12 18:01:25 -07:00
Andrew Kane
53301021f6 Added dimensions check to vector_avg 2023-05-12 17:19:16 -07:00
Andrew Kane
8f589f6d09 Added test for array_to_vector 2023-05-12 17:14:29 -07:00
Nathan Bossart
dcf206128a Check bounds unconditionally in array_to_vector(). (#127)
Presently, array_to_vector()'s call to CheckDim() is skipped when typmod != -1, which allows for bypassing VECTOR_MAX_DIM.  To fix, call Check[Expected]Dim() unconditionally.  CheckExpectedDim() takes no action when typmod == -1, so there's no need to guard it with an 'if' statement.
2023-05-12 17:08:51 -07:00
Andrew Kane
3244d40e8a Added note about --preserve-env [skip ci] 2023-05-10 12:13:15 -07:00
Andrew Kane
7d8dbcaa3c Added note about Homebrew Postgres [skip ci] 2023-05-10 12:06:30 -07:00
Andrew Kane
7f575f55fb Removed block size note - #120 [skip ci] 2023-05-09 14:43:24 -07:00
Andrew Kane
94e7487d5f Fixed link [skip ci] 2023-05-06 12:33:20 -07:00
Andrew Kane
74a3cd597f Improved Docker tasks [skip ci] 2023-05-06 12:11:10 -07:00
Andrew Kane
db8ed738b8 Split Docker tasks [skip ci] 2023-05-06 11:59:46 -07:00
Andrew Kane
54c550420b Added Docker image for linux/arm64 - closes #115 2023-05-06 11:50:59 -07:00
Fabian Fischer
cc539a0a27 docs: aws rds supports pgvector now (#110) 2023-05-03 13:08:06 -07:00
Andrew Kane
d885e2bcfa Added FAQ about results [skip ci] 2023-05-02 10:17:31 -07:00
14 changed files with 43 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
## 0.4.2 (unreleased)
## 0.4.2 (2023-05-13)
- Added notice when index created with little data
- Fixed dimensions check for some direct function calls
- Fixed installation error with Postgres 12.0-12.2
## 0.4.1 (2023-03-21)

View File

@@ -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.4.1",
"version": "0.4.2",
"maintainer": [
"Andrew Kane <andrew@ankane.org>"
],
@@ -20,7 +20,7 @@
"vector": {
"file": "sql/vector.sql",
"docfile": "README.md",
"version": "0.4.1",
"version": "0.4.2",
"abstract": "Open-source vector similarity search for Postgres"
}
},

View File

@@ -1,5 +1,5 @@
EXTENSION = vector
EXTVERSION = 0.4.1
EXTVERSION = 0.4.2
MODULE_big = vector
DATA = $(wildcard sql/*--*.sql)
@@ -63,3 +63,9 @@ dist:
docker:
docker build --pull --no-cache --platform linux/amd64 -t ankane/pgvector:latest .
.PHONY: docker-release
docker-release:
docker buildx build --push --pull --no-cache --platform linux/amd64,linux/arm64 -t ankane/pgvector:latest .
docker buildx build --push --platform linux/amd64,linux/arm64 -t ankane/pgvector:v$(EXTVERSION) .

View File

@@ -1,5 +1,5 @@
EXTENSION = vector
EXTVERSION = 0.4.1
EXTVERSION = 0.4.2
OBJS = src\ivfbuild.obj src\ivfflat.obj src\ivfinsert.obj src\ivfkmeans.obj src\ivfscan.obj src\ivfutils.obj src\ivfvacuum.obj src\vector.obj

View File

@@ -16,7 +16,7 @@ Compile and install the extension (supports Postgres 11+)
```sh
cd /tmp
git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git
git clone --branch v0.4.2 https://github.com/pgvector/pgvector.git
cd pgvector
make
make install # may need sudo
@@ -307,10 +307,11 @@ Yes, pgvector uses the write-ahead log (WAL), which allows for replication and p
#### What if I want to index vectors with more than 2,000 dimensions?
Two things you can try are:
Youll need to use [dimensionality reduction](https://en.wikipedia.org/wiki/Dimensionality_reduction) at the moment.
1. use dimensionality reduction
2. compile Postgres with a larger block size (`./configure --with-blocksize=32`) and edit the limit in `src/ivfflat.h`
#### Why am I seeing less results after adding an index?
The index was likely created with too little data for the number of lists. Drop the index until the table has more data.
## Reference
@@ -354,7 +355,11 @@ If your machine has multiple Postgres installations, specify the path to [pg_con
export PG_CONFIG=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
```
Then re-run the installation instructions (run `make clean` before `make` if needed)
Then re-run the installation instructions (run `make clean` before `make` if needed). If `sudo` is needed for `make install`, use:
```sh
sudo --preserve-env=PG_CONFIG make install
```
### Missing Header
@@ -374,7 +379,7 @@ Support for Windows is currently experimental. Use `nmake` to build:
```cmd
set "PGROOT=C:\Program Files\PostgreSQL\15"
git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git
git clone --branch v0.4.2 https://github.com/pgvector/pgvector.git
cd pgvector
nmake /F Makefile.win
nmake /F Makefile.win install
@@ -395,7 +400,7 @@ This adds pgvector to the [Postgres image](https://hub.docker.com/_/postgres) (r
You can also build the image manually:
```sh
git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git
git clone --branch v0.4.2 https://github.com/pgvector/pgvector.git
cd pgvector
docker build -t pgvector .
```
@@ -408,6 +413,8 @@ With Homebrew Postgres, you can use:
brew install pgvector
```
Note: This only adds it to the `postgresql@14` formula
### PGXN
Install from the [PostgreSQL Extension Network](https://pgxn.org/dist/vector) with:
@@ -444,10 +451,9 @@ pgvector is available on [these providers](https://github.com/pgvector/pgvector/
To request a new extension on other providers:
- Amazon RDS - follow the instructions on [this page](https://aws.amazon.com/rds/postgresql/faqs/)
- Google Cloud SQL - vote or comment on [this page](https://issuetracker.google.com/issues/265172065)
- Azure Database - vote or comment on [this page](https://feedback.azure.com/d365community/idea/7b423322-6189-ed11-a81b-000d3ae49307)
- DigitalOcean Managed Databases - vote or comment on [this page](https://ideas.digitalocean.com/app-framework-services/p/pgvector-extension-for-postgresql)
- DigitalOcean Managed Databases - vote or comment on [this page](https://ideas.digitalocean.com/managed-database/p/pgvector-extension-for-postgresql)
- Heroku Postgres - vote or comment on [this page](https://github.com/heroku/roadmap/issues/156)
## Upgrading

View File

@@ -0,0 +1,2 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "ALTER EXTENSION vector UPDATE TO '0.4.2'" to load this file. \quit

View File

@@ -438,8 +438,8 @@ ComputeCenters(IvfflatBuildState * buildstate)
{
ereport(NOTICE,
(errmsg("ivfflat index created with little data"),
errdetail("this will cause poor recall"),
errhint("drop the index until the table has more data")));
errdetail("This will cause low recall."),
errhint("Drop the index until the table has more data.")));
}
}

View File

@@ -174,8 +174,8 @@ GetScanItems(IndexScanDesc scan, Datum value)
if (tuples < 100)
ereport(DEBUG1,
(errmsg("index scan found few tuples"),
errdetail("index may have been created without data or lists is too high"),
errhint("recreate the index and possibly decrease lists")));
errdetail("Index may have been created with little data."),
errhint("Recreate the index and possibly decrease lists.")));
tuplesort_performsort(so->sortstate);
}

View File

@@ -396,10 +396,8 @@ array_to_vector(PG_FUNCTION_ARGS)
get_typlenbyvalalign(ARR_ELEMTYPE(array), &typlen, &typbyval, &typalign);
deconstruct_array(array, ARR_ELEMTYPE(array), typlen, typbyval, typalign, &elemsp, &nullsp, &nelemsp);
if (typmod == -1)
CheckDim(nelemsp);
else
CheckExpectedDim(typmod, nelemsp);
CheckDim(nelemsp);
CheckExpectedDim(typmod, nelemsp);
result = InitVector(nelemsp);
for (i = 0; i < nelemsp; i++)
@@ -952,6 +950,7 @@ vector_avg(PG_FUNCTION_ARGS)
/* Create vector */
dim = STATE_DIMS(statearray);
CheckDim(dim);
result = InitVector(dim);
for (int i = 0; i < dim; i++)
{

View File

@@ -46,6 +46,8 @@ SELECT '[1,2,3]'::vector::real[];
SELECT array_agg(n)::vector FROM generate_series(1, 16001) n;
ERROR: vector cannot have more than 16000 dimensions
SELECT array_to_vector(array_agg(n), 16001, false) FROM generate_series(1, 16001) n;
ERROR: vector cannot have more than 16000 dimensions
-- ensure no error
SELECT ARRAY[1,2,3] = ARRAY[1,2,3];
?column?

View File

@@ -102,3 +102,5 @@ SELECT avg(v) FROM unnest(ARRAY[]::vector[]) v;
SELECT avg(v) FROM unnest(ARRAY['[1,2]'::vector, '[3]']) v;
ERROR: expected 2 dimensions, not 1
SELECT vector_avg(array_agg(n)) FROM generate_series(1, 16002) n;
ERROR: vector cannot have more than 16000 dimensions

View File

@@ -10,6 +10,7 @@ SELECT '{-Infinity}'::real[]::vector;
SELECT '{}'::real[]::vector;
SELECT '[1,2,3]'::vector::real[];
SELECT array_agg(n)::vector FROM generate_series(1, 16001) n;
SELECT array_to_vector(array_agg(n), 16001, false) FROM generate_series(1, 16001) n;
-- ensure no error
SELECT ARRAY[1,2,3] = ARRAY[1,2,3];

View File

@@ -24,3 +24,4 @@ SELECT avg(v) FROM unnest(ARRAY['[1,2,3]'::vector, '[3,5,7]']) v;
SELECT avg(v) FROM unnest(ARRAY['[1,2,3]'::vector, '[3,5,7]', NULL]) v;
SELECT avg(v) FROM unnest(ARRAY[]::vector[]) v;
SELECT avg(v) FROM unnest(ARRAY['[1,2]'::vector, '[3]']) v;
SELECT vector_avg(array_agg(n)) FROM generate_series(1, 16002) n;

View File

@@ -1,4 +1,4 @@
comment = 'vector data type and ivfflat access method'
default_version = '0.4.1'
default_version = '0.4.2'
module_pathname = '$libdir/vector'
relocatable = true