summaryrefslogtreecommitdiff
path: root/util/updates/update_wip_lists.sql
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-12-22 16:24:58 +0100
committerYorhel <git@yorhel.nl>2019-12-22 16:29:10 +0100
commitcd5e4dffdf4d99cac7d47433981cfa6d669b2b45 (patch)
treedc1f7ee0df86a6f3e38807b07bb1b0de2cd987c6 /util/updates/update_wip_lists.sql
parent1b47e52e88d90478ff39744732085924fe5a51f2 (diff)
ulist: Use new lists for VN vote stats & listing
To my surprise, I actually managed to achieve acceptable performance by just adding two indices. I totally expected I'd have to keep a cache column in ulist_vns whether the row is private or not. The partial index on the users table in fact improves the performance of the vote graph query. A covering index improves that even further, but that requires Postgres 11+, which the Docker image doesn't have yet (and isn't all that crucial anyway). There's a rather annoying potential for confusion regarding the private flag on votes. The user page & list stats only look at whether the 'Voted' label is private, whereas the VN stats use the "proper" approach of checking for any public label. Not entirely sure which of the two is more intuitive.
Diffstat (limited to 'util/updates/update_wip_lists.sql')
-rw-r--r--util/updates/update_wip_lists.sql2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/updates/update_wip_lists.sql b/util/updates/update_wip_lists.sql
index a327f854..c07e4ba1 100644
--- a/util/updates/update_wip_lists.sql
+++ b/util/updates/update_wip_lists.sql
@@ -129,3 +129,5 @@ ALTER TABLE users ADD COLUMN c_wish integer NOT NULL DEFAULT 0;
\timing
SELECT update_users_ulist_stats(NULL);
+CREATE INDEX ulist_vns_voted ON ulist_vns (vid, vote_date) WHERE vote IS NOT NULL;
+CREATE INDEX users_ign_votes ON users (id) WHERE ign_votes;