From 1ed3816d6fb5882b590481aa7a9b34852bcec392 Mon Sep 17 00:00:00 2001 From: Patrick Marschik Date: Wed, 20 Jan 2021 13:19:40 +0100 Subject: [PATCH] PostgreSQL index optimizations --- database/migrations.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/migrations.go b/database/migrations.go index f5177d06..5e511ea4 100644 --- a/database/migrations.go +++ b/database/migrations.go @@ -496,4 +496,12 @@ var migrations = []func(tx *sql.Tx) error{ `) return err }, + func(tx *sql.Tx) (err error) { + _, err = tx.Exec(` + CREATE INDEX entries_feed_url_idx ON entries(feed_id, url); + CREATE INDEX entries_user_feed_idx ON entries(user_id, status, feed_id); + CREATE INDEX entries_user_status_changed_idx ON entries(user_id, status, changed_at); + `) + return err + }, }