Created
October 20, 2023 14:49
-
-
Save vielhuber/45f3493a5ac6ef5048d492674dc12349 to your computer and use it in GitHub Desktop.
indexes #postgres
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
--SELECT to_tsquery('german', 'The & Fat & Rats'); | |
--DROP INDEX IF EXISTS jo; | |
--DROP TABLE IF EXISTS foo; | |
CREATE TABLE IF EXISTS foo ( | |
bar text, | |
baz text | |
); | |
INSERT INTO foo (bar, baz) VALUES | |
('a', 'b'), | |
('c', 'd'); | |
CREATE INDEX jo ON foo USING gin (to_tsvector('german', bar)); | |
SET enable_seqscan = OFF; | |
EXPLAIN ANALYZE SELECT * FROM | |
foo | |
WHERE | |
--bar like '%Test%' | |
--baz like '%oooooooooooo%' | |
to_tsvector('german', bar) @@ to_tsquery('german', 'e') | |
--to_tsvector('german', baz) @@ to_tsquery('german', 'f') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment