Compare commits

...

14 Commits

Author SHA1 Message Date
Andrew Kane
60bc93f938 Version bump to 0.1.5 [skip ci] 2021-05-25 17:31:02 -07:00
Andrew Kane
87a1b3365e Simplified logic 2021-05-24 18:58:11 -07:00
Andrew Kane
e9a762223b Moved line [skip ci] 2021-05-24 18:48:49 -07:00
Andrew Kane
db83f4faa8 Reduced memory usage during index build - #7 2021-05-24 18:40:34 -07:00
Andrew Kane
2cf71ec6bd Moved test [skip ci] 2021-05-15 00:29:52 -07:00
Andrew Kane
a7510430e3 Added test for max dimensions 2021-05-15 00:28:02 -07:00
Andrew Kane
ea8f06e8f4 Updated readme [skip ci] 2021-05-14 22:05:07 -07:00
Andrew Kane
4e0c1a137c Version bump to 0.1.4 [skip ci] 2021-05-09 14:21:29 -07:00
Andrew Kane
c758b7b188 Simplified upgrade statement [skip ci] 2021-05-09 14:19:05 -07:00
Andrew Kane
3dffc01e31 Improved comment [skip ci] 2021-05-06 22:40:04 -07:00
Andrew Kane
b8f3688e41 Fixed kmeans for inner product 2021-05-06 22:31:17 -07:00
Andrew Kane
67e317141b Fixed multiple definition error with GCC 10 - #4 2021-05-06 16:25:43 -07:00
Andrew Kane
de2ce0b1eb Added dockerignore [skip ci] 2021-05-06 15:30:02 -07:00
Andrew Kane
86c1c95ef4 Updated readme [skip ci] 2021-05-06 14:50:59 -07:00
13 changed files with 45 additions and 15 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
/.git/
/dist/
/results/
/tmp_check/
/sql/vector--?.?.?.sql
regression.*
*.o
*.so

View File

@@ -1,3 +1,12 @@
## 0.1.5 (2021-05-25)
- Reduced memory usage during index creation
## 0.1.4 (2021-05-09)
- Fixed kmeans for inner product
- Fixed multiple definition error with GCC 10
## 0.1.3 (2021-05-06)
- Added Dockerfile

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

View File

@@ -1,5 +1,5 @@
EXTENSION = vector
EXTVERSION = 0.1.3
EXTVERSION = 0.1.5
MODULE_big = vector
DATA = $(wildcard sql/*--*.sql)

View File

@@ -17,7 +17,7 @@ Supports L2 distance, inner product, and cosine distance
Compile and install the extension (supports Postgres 9.6+)
```sh
git clone --branch v0.1.3 https://github.com/ankane/pgvector.git
git clone --branch v0.1.5 https://github.com/ankane/pgvector.git
cd pgvector
make
make install # may need sudo
@@ -153,7 +153,7 @@ This adds pgvector to the [Postgres image](https://hub.docker.com/_/postgres).
You can also build the image manually
```sh
git clone --branch v0.1.3 https://github.com/ankane/pgvector.git
git clone --branch v0.1.5 https://github.com/ankane/pgvector.git
cd pgvector
docker build -t pgvector .
```
@@ -184,12 +184,10 @@ Some Postgres providers only support specific extensions. To request a new exten
## Upgrading
### 0.1.1
Compile and install the latest version and run:
Install the latest version and run:
```sql
ALTER EXTENSION vector UPDATE TO '0.1.1';
ALTER EXTENSION vector UPDATE;
```
## Thanks
@@ -234,7 +232,7 @@ make prove_installcheck # TAP tests
To run single tests:
```sh
make installcheck REGRESS=vector # regression test
make installcheck REGRESS=functions # regression test
make prove_installcheck PROVE_TESTS=test/t/001_wal.pl # TAP test
```

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.1.4'" to load this file. \quit

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.1.5'" to load this file. \quit

View File

@@ -41,10 +41,13 @@ SampleCallback(Relation index, CALLBACK_ITEM_POINTER, Datum *values,
if (isnull[0])
return;
/* Normalize the value */
if (buildstate->normprocinfo != NULL)
/*
* Normalize with KMEANS_NORM_PROC since spherical distance function
* expects unit vectors
*/
if (buildstate->kmeansnormprocinfo != NULL)
{
if (!IvfflatNormValue(buildstate->normprocinfo, buildstate->collation, &value, buildstate->normvec))
if (!IvfflatNormValue(buildstate->kmeansnormprocinfo, buildstate->collation, &value, buildstate->normvec))
return;
}
@@ -238,6 +241,8 @@ InsertTuples(Relation index, IvfflatBuildState * buildstate, ForkNumber forkNum)
if (PageAddItem(page, (Item) itup, itemsz, InvalidOffsetNumber, false, false) == InvalidOffsetNumber)
elog(ERROR, "failed to add index item to \"%s\"", RelationGetRelationName(index));
pfree(itup);
buildstate->indtuples += 1;
GetNextTuple(buildstate->sortstate, tupdesc, slot, &itup, &list);
@@ -275,6 +280,7 @@ InitBuildState(IvfflatBuildState * buildstate, Relation heap, Relation index, In
/* Get support functions */
buildstate->procinfo = index_getprocinfo(index, 1, IVFFLAT_DISTANCE_PROC);
buildstate->normprocinfo = IvfflatOptionalProcInfo(index, IVFFLAT_NORM_PROC);
buildstate->kmeansnormprocinfo = IvfflatOptionalProcInfo(index, IVFFLAT_KMEANS_NORM_PROC);
buildstate->collation = index->rd_indcollation[0];
/* Create tuple description for sorting */

View File

@@ -6,6 +6,7 @@
#include "utils/guc.h"
#include "utils/selfuncs.h"
int ivfflat_probes;
static relopt_kind ivfflat_relopt_kind;
/*

View File

@@ -38,7 +38,7 @@
#endif
/* Variables */
int ivfflat_probes;
extern int ivfflat_probes;
typedef struct VectorArrayData
{
@@ -81,6 +81,7 @@ typedef struct IvfflatBuildState
/* Support functions */
FmgrInfo *procinfo;
FmgrInfo *normprocinfo;
FmgrInfo *kmeansnormprocinfo;
Oid collation;
/* Variables */

View File

@@ -28,3 +28,5 @@ SELECT '{-Infinity}'::real[]::vector;
ERROR: infinite value not allowed in vector
SELECT '{}'::real[]::vector;
ERROR: vector must have at least 1 dimension
SELECT array_agg(n)::vector FROM generate_series(1, 1025) n;
ERROR: vector cannot have more than 1024 dimensions

View File

@@ -9,3 +9,4 @@ SELECT '{NaN}'::real[]::vector;
SELECT '{Infinity}'::real[]::vector;
SELECT '{-Infinity}'::real[]::vector;
SELECT '{}'::real[]::vector;
SELECT array_agg(n)::vector FROM generate_series(1, 1025) n;

View File

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