Last active
July 11, 2016 19:05
-
-
Save wyattjoh/2d314f60ccd43a628466fb9366f2367f to your computer and use it in GitHub Desktop.
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
postgres=# EXPLAIN SELECT name FROM categories WHERE similarity(name, 'cr') > 0.3; | |
QUERY PLAN | |
---------------------------------------------------------------------------- | |
Seq Scan on categories (cost=0.00..208.55 rows=2323 width=9) | |
Filter: (similarity((name)::text, 'cr'::text) > '0.3'::double precision) | |
(2 rows) |
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
CREATE TABLE venue( | |
id VARCHAR(24) UNIQUE PRIMARY KEY | |
); | |
CREATE TABLE categories( | |
venue_id VARCHAR(24) REFERENCES venue(id) ON DELETE CASCADE, | |
name VARCHAR(30) | |
); | |
CREATE INDEX category_name_idx ON tags USING GIST(name gist_trgm_ops); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment