discourse/db
Sam 29fac1ac18 PERF: improve performance of unread queries
Figuring out what unread topics a user has is a very expensive
operation over time.

Users can easily accumulate 10s of thousands of tracking state rows
(1 for every topic they ever visit)

When figuring out what a user has that is unread we need to join
the tracking state records to the topic table. This can very quickly
lead to cases where you need to scan through the entire topic table.

This commit optimises it so we always keep track of the "first" date
a user has unread topics. Then we can easily filter out all earlier
topics from the join.

We use pg functions, instead of nested queries here to assist the
planner.
2017-05-25 15:07:30 -04:00
..
fixtures fix deploy problems due to renamed table 2017-05-12 15:17:25 -04:00
migrate PERF: improve performance of unread queries 2017-05-25 15:07:30 -04:00
api_test_seeds.rb add rake task and seed data for discourse_api 2014-09-10 20:53:21 -06:00