pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] issue #664: difference in output with seq scan and index scan on vector column.
3+ messages / 2 participants
[nested] [flat]

* [pgvector/pgvector] issue #664: difference in output with seq scan and index scan on vector column.
@ 2024-08-30 07:49  "avulasaikiran (@avulasaikiran)" <noreply+avulasaikiran@github.com>
  0 siblings, 0 replies; 3+ messages in thread

From: avulasaikiran (@avulasaikiran) @ 2024-08-30 07:49 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi,

I am seeing following behavior with vector extension. Is this expected or is this a known issue?

postgres=# set enable_seqscan = on;
SET
postgres=# SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector);
 id |   val   
----+---------
  1 | [0,0,0]
  2 | [1,2,3]
  3 | [1,1,1]
  4 | 
  5 | [1,2,4]
(5 rows)

postgres=# 
postgres=# 
postgres=# set enable_seqscan = off;
SET
postgres=# SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector);
 id |   val   
----+---------
  2 | [1,2,3]
  3 | [1,1,1]
  5 | [1,2,4]
(3 rows)




Following is my setup:

CREATE EXTENSION vector;
CREATE TABLE t (id SERIAL, val vector(3));
CALL rds_aurora.limitless_table_alter_type_sharded_and_wait('t', ARRAY['id']);
INSERT INTO t (val) VALUES ('[0,0,0]'), ('[1,2,3]'), ('[1,1,1]'), (NULL);
CREATE INDEX ON t USING ivfflat (val vector_cosine_ops) WITH (lists = 1);
INSERT INTO t (val) VALUES ('[1,2,4]');



postgres=# select * from pg_extension where extname = 'vector';
  oid  | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition 
-------+---------+----------+--------------+----------------+------------+-----------+--------------
 16403 | vector  |       10 |         2200 | t              | 0.7.3      |           | 
(1 row)


^ permalink  raw  [nested|flat] 3+ messages in thread

* Re: [pgvector/pgvector] issue #664: difference in output with seq scan and index scan on vector column.
@ 2024-08-30 08:06  "ankane (@ankane)" <noreply+ankane@github.com>
  1 sibling, 0 replies; 3+ messages in thread

From: ankane (@ankane) @ 2024-08-30 08:06 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @avulasaikiran, `NULL` vectors are not indexed, as well as zero vectors for cosine distance ([docs](https://github.com/pgvector/pgvector?tab=readme-ov-file#why-are-there-less-results-for-a-query-after...)).

^ permalink  raw  [nested|flat] 3+ messages in thread

* Re: [pgvector/pgvector] issue #664: difference in output with seq scan and index scan on vector column.
@ 2024-08-30 08:06  "ankane (@ankane)" <noreply+ankane@github.com>
  1 sibling, 0 replies; 3+ messages in thread

From: ankane (@ankane) @ 2024-08-30 08:06 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-08-30 08:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-08-30 07:49 [pgvector/pgvector] issue #664: difference in output with seq scan and index scan on vector column. "avulasaikiran (@avulasaikiran)" <noreply+avulasaikiran@github.com>
2024-08-30 08:06 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-08-30 08:06 ` "ankane (@ankane)" <noreply+ankane@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox