Increased max dimensions for vector from 1024 to 16000 and increased max dimensions for index from 1024 to 2000

This commit is contained in:
Andrew Kane
2023-01-10 14:49:50 -08:00
parent 42d0cf1a25
commit 7b0b6a7875
6 changed files with 10 additions and 5 deletions

View File

@@ -2,6 +2,8 @@
- Changed text representation for vector elements to match `real` - Changed text representation for vector elements to match `real`
- Changed storage for vector from `plain` to `extended` - Changed storage for vector from `plain` to `extended`
- Increased max dimensions for vector from 1024 to 16000
- Increased max dimensions for index from 1024 to 2000
- Improved accuracy of text parsing for certain inputs - Improved accuracy of text parsing for certain inputs
- Added `avg` aggregate for vector - Added `avg` aggregate for vector
- Added experimental support for Windows - Added experimental support for Windows

View File

@@ -23,7 +23,7 @@
#include "portability/instr_time.h" #include "portability/instr_time.h"
#endif #endif
#define IVFFLAT_MAX_DIM VECTOR_MAX_DIM #define IVFFLAT_MAX_DIM 2000
/* Support functions */ /* Support functions */
#define IVFFLAT_DISTANCE_PROC 1 #define IVFFLAT_DISTANCE_PROC 1

View File

@@ -3,7 +3,7 @@
#include "postgres.h" #include "postgres.h"
#define VECTOR_MAX_DIM 1024 #define VECTOR_MAX_DIM 16000
#define VECTOR_SIZE(_dim) (offsetof(Vector, x) + sizeof(float)*(_dim)) #define VECTOR_SIZE(_dim) (offsetof(Vector, x) + sizeof(float)*(_dim))
#define DatumGetVector(x) ((Vector *) PG_DETOAST_DATUM(x)) #define DatumGetVector(x) ((Vector *) PG_DETOAST_DATUM(x))

View File

@@ -38,8 +38,8 @@ SELECT '[1,2,3]'::vector::real[];
{1,2,3} {1,2,3}
(1 row) (1 row)
SELECT array_agg(n)::vector FROM generate_series(1, 1025) n; SELECT array_agg(n)::vector FROM generate_series(1, 16001) n;
ERROR: vector cannot have more than 1024 dimensions ERROR: vector cannot have more than 16000 dimensions
-- ensure no error -- ensure no error
SELECT ARRAY[1,2,3] = ARRAY[1,2,3]; SELECT ARRAY[1,2,3] = ARRAY[1,2,3];
?column? ?column?

View File

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

View File

@@ -56,6 +56,9 @@ if ($dim > 32) {
# TODO use wal_keep_segments for Postgres < 13 # TODO use wal_keep_segments for Postgres < 13
$node_primary->append_conf('postgresql.conf', qq(wal_keep_size = 1GB)); $node_primary->append_conf('postgresql.conf', qq(wal_keep_size = 1GB));
} }
if ($dim > 1500) {
$node_primary->append_conf('postgresql.conf', qq(maintenance_work_mem = 128MB));
}
$node_primary->start; $node_primary->start;
my $backup_name = 'my_backup'; my $backup_name = 'my_backup';