You've already forked pgvecto.rs
mirror of
https://github.com/tensorchord/pgvecto.rs.git
synced 2025-08-08 14:22:07 +03:00
38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
statement ok
|
|
SET search_path TO pg_temp, vectors;
|
|
|
|
statement ok
|
|
CREATE TABLE t (id bigserial, val bvector);
|
|
|
|
statement ok
|
|
INSERT INTO t (val) SELECT NULL FROM generate_series(1, 1000);
|
|
|
|
statement ok
|
|
INSERT INTO t (val) SELECT ARRAY[ROUND(RANDOM()::numeric, 0)]::real[]::vector::bvector FROM generate_series(1, 1000);
|
|
|
|
statement ok
|
|
INSERT INTO t (val) SELECT ARRAY[ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0)]::real[]::vector::bvector FROM generate_series(1, 1000);
|
|
|
|
statement ok
|
|
INSERT INTO t (val) SELECT ARRAY[ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0), ROUND(RANDOM()::numeric, 0)]::real[]::vector::bvector FROM generate_series(1, 1000);
|
|
|
|
statement ok
|
|
COPY t TO '/tmp/data.bin' WITH (FORMAT binary);
|
|
|
|
statement ok
|
|
CREATE TABLE t2 (id bigserial, val bvector);
|
|
|
|
statement ok
|
|
COPY t2 FROM '/tmp/data.bin' WITH (FORMAT binary);
|
|
|
|
query I
|
|
SELECT SUM(((t.val = t2.val) OR (t.val IS NULL and t2.val IS NULL))::int) FROM t FULL OUTER JOIN t2 ON t.id = t2.id;
|
|
----
|
|
4000
|
|
|
|
statement ok
|
|
DROP TABLE t;
|
|
|
|
statement ok
|
|
DROP TABLE t2;
|