summaryrefslogtreecommitdiff
path: root/util/updates/update_wip_lists.sql
AgeCommit message (Collapse)AuthorFilesLines
2020-01-01ulist: Time to put this live2.27Yorhel1-135/+0
Decided to change the naming scheme of files in util/updates/
2019-12-30Minor refactor: Move all trigger functions and declarations to separate fileYorhel1-6/+4
This keeps the function body and the trigger declaration closer to each other, so it's easier to tell when the function will be called and which cases it needs to handle. If you ignore errors from existing trigger declarations, the triggers.sql script is idempotent and can be used in from scripts.
2019-12-30ulist: Remove remnants of old votes/vnlists/wlists tablesYorhel1-3/+7
2019-12-22ulist: Use new lists for VN vote stats & listingYorhel1-0/+2
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.
2019-12-19ulist: Update user list with vnlist/votes/wishlist statsYorhel1-8/+7
This adds the users.c_vns and c_wish columns and a function to update the cache. Unlike my previous cache update approaches, I did not use SQL triggers here, as that seemed more complex and less efficient than updating the cache manually. That's not to say that I'm happy with the current approach, but meh... The cache update function is not automatically run for all users, but that could be added to Multi::Maintenance if it turns out that the cached values will not be updated properly in some cases.
2019-12-17ulist: Synchronize changes between rlists and ulist_vnsYorhel1-0/+1
These ensure that, for each row in rlists, all the linked VNs have an entry in ulist_vns. This implementation should be more robust than before; It now isn't possible to remove an item from ulist_vns without also removing all relevant rows from rlists, and adding more VNs to an existing release entry will ensure that those VNs are also added to ulist_vns.
2019-12-16ulist: Convert vn.c_* vote stat updating to use ulist_vns tableYorhel1-0/+2
It turned out that naively changing the existing queries to refer to ulist_vns with a (WHERE vote IS NOT NULL) made them ultra slow (like, DNF-slow), for a reason I haven't been able to figure out yet. I had to rewrite the queries to use CTEs and in doing so figured that I could get an extra performance improvement by combining the popularity and rating updates in one query. The combined update function now runs faster than the old queries.
2019-12-16ulist: Integrate update script into SQL + update notify_listdel()Yorhel1-28/+1
2019-12-03API: Add "get ulist-labels" and "get ulist"Yorhel1-0/+4
To directly query the new list feature. I'll migrate the old vnlist/wishlist/votelist APIs later to query the 'ulist' tables.
2019-11-10ulist: Fix migration script to properly delete tables & handle concurrent ↵Yorhel1-2/+7
changes
2019-11-10ulist: SQL: Create labels for new users + auto-assign Voted label + import ↵Yorhel1-5/+57
rlisted VNs
2019-11-10ulist: Rename tables to something more sensibleYorhel1-16/+16
2019-11-10ulist: Use lower numbers for custom labels + add VN listingYorhel1-54/+17
2019-11-10ulist: Add data model for new lists + Perl/Elm for label managementYorhel1-0/+132
Very much experimental. I'm not sure this is even the right model.