Closed min-mwei closed 1 year ago
I see.
You are trying to create an index on an empty table. The problem is that the index does not know the dimension of the vectors you will be inserting.
The CREATE INDEX
statement on an empty table should work fine once you explicitly state dimensions of the vectors in the index as below:
CREATE INDEX ON small_world USING lantern_hnsw (vector) WITH (dim = 3);
I think you expect to not need the dimension specification because you already specify the dimension of the real[]
array in CREATE TABLE statement (
real[3]) But postgres actually does not enforce dimensions on arrays and the
3in
real[3]` ends up just being decorative/documentation. So, our index has no way of picking it up.
Does this fix the issue?
Thanks for the quick response, yes, this addresses this issue.
Looks like there must be at least one row in the table before one could create a lantern index. Take the "hello world" example,
This above will fail with the message in the title. Of course if one add insert the create table, it works.
Thanks.