-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
315 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
SET enable_seqscan = off; | ||
CREATE TABLE t (val bit(3)); | ||
INSERT INTO t (val) VALUES (B'000'), (B'100'), (B'111'), (NULL); | ||
CREATE INDEX ON t USING ivfflat (val bit_hamming_ops) WITH (lists = 1); | ||
INSERT INTO t (val) VALUES (B'110'); | ||
SELECT * FROM t ORDER BY val <~> B'111'; | ||
val | ||
----- | ||
111 | ||
110 | ||
100 | ||
000 | ||
(4 rows) | ||
|
||
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <~> (SELECT NULL::bit)) t2; | ||
count | ||
------- | ||
4 | ||
(1 row) | ||
|
||
DROP TABLE t; | ||
-- TODO move | ||
CREATE TABLE t (val varbit(3)); | ||
CREATE INDEX ON t USING ivfflat (val bit_hamming_ops) WITH (lists = 1); | ||
ERROR: type not supported for ivfflat index | ||
CREATE INDEX ON t USING ivfflat ((val::bit(3)) bit_hamming_ops) WITH (lists = 1); | ||
NOTICE: ivfflat index created with little data | ||
DETAIL: This will cause low recall. | ||
HINT: Drop the index until the table has more data. | ||
CREATE INDEX ON t USING ivfflat ((val::bit(64001)) bit_hamming_ops) WITH (lists = 1); | ||
ERROR: column cannot have more than 64000 dimensions for ivfflat index | ||
DROP TABLE t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
SET enable_seqscan = off; | ||
CREATE TABLE t (val bit(4)); | ||
INSERT INTO t (val) VALUES (B'0000'), (B'1100'), (B'1111'), (NULL); | ||
CREATE INDEX ON t USING ivfflat (val bit_jaccard_ops) WITH (lists = 1); | ||
INSERT INTO t (val) VALUES (B'1110'); | ||
SELECT * FROM t ORDER BY val <%> B'1111'; | ||
val | ||
------ | ||
1111 | ||
1110 | ||
1100 | ||
0000 | ||
(4 rows) | ||
|
||
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <%> (SELECT NULL::bit)) t2; | ||
count | ||
------- | ||
4 | ||
(1 row) | ||
|
||
DROP TABLE t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
SET enable_seqscan = off; | ||
|
||
CREATE TABLE t (val bit(3)); | ||
INSERT INTO t (val) VALUES (B'000'), (B'100'), (B'111'), (NULL); | ||
CREATE INDEX ON t USING ivfflat (val bit_hamming_ops) WITH (lists = 1); | ||
|
||
INSERT INTO t (val) VALUES (B'110'); | ||
|
||
SELECT * FROM t ORDER BY val <~> B'111'; | ||
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <~> (SELECT NULL::bit)) t2; | ||
|
||
DROP TABLE t; | ||
|
||
-- TODO move | ||
CREATE TABLE t (val varbit(3)); | ||
CREATE INDEX ON t USING ivfflat (val bit_hamming_ops) WITH (lists = 1); | ||
CREATE INDEX ON t USING ivfflat ((val::bit(3)) bit_hamming_ops) WITH (lists = 1); | ||
CREATE INDEX ON t USING ivfflat ((val::bit(64001)) bit_hamming_ops) WITH (lists = 1); | ||
DROP TABLE t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
SET enable_seqscan = off; | ||
|
||
CREATE TABLE t (val bit(4)); | ||
INSERT INTO t (val) VALUES (B'0000'), (B'1100'), (B'1111'), (NULL); | ||
CREATE INDEX ON t USING ivfflat (val bit_jaccard_ops) WITH (lists = 1); | ||
|
||
INSERT INTO t (val) VALUES (B'1110'); | ||
|
||
SELECT * FROM t ORDER BY val <%> B'1111'; | ||
SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <%> (SELECT NULL::bit)) t2; | ||
|
||
DROP TABLE t; |
Oops, something went wrong.