From 647a78076430968ab847f582f1b1fa53b80b2261 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 29 Apr 2015 08:54:46 +0200 Subject: [PATCH] add SQL info on how to pimp the DB --- sql/pimp_db.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sql/pimp_db.sql diff --git a/sql/pimp_db.sql b/sql/pimp_db.sql new file mode 100644 index 0000000..48bc670 --- /dev/null +++ b/sql/pimp_db.sql @@ -0,0 +1,18 @@ + +CREATE VIEW orig_repos AS + SELECT id, name, full_name, html_url, description, last_seen + FROM repos + WHERE NOT fork; + +CREATE VIEW fork_repos AS + SELECT id, name, full_name, html_url, description, last_seen + FROM repos + WHERE fork + +CREATE EXTENSION pg_trgm; + +CREATE INDEX ix_trgm_repos_description ON + repos USING gin (description gin_trgm_ops); + +CREATE INDEX ix_trgm_repos_full_name ON + repos USING gin (full_name gin_trgm_ops);