discourse/spec/components
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
..
active_record/connection_adapters Use a different Redis key when PG failover sets site to readonly mode. 2017-01-11 16:38:49 +08:00
auth FIX: Improve token rotation and increase logging 2017-03-07 13:27:43 -05:00
common_passwords Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
concern FIX: Query for category hashtag should be case sensitive. 2016-03-28 11:15:10 +08:00
demon Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
email FIX: remove memoization on class method used in a job 2017-05-22 23:35:41 +02:00
file_store REFACTOR: Get bucket name from S3Helper. 2016-08-19 14:08:37 +08:00
freedom_patches FIX: translations with a symbol as key should also be overridable 2016-08-24 11:53:03 +02:00
highlight_js Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
import Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
middleware FEATURE: brotli cdn bypass for assets 2016-12-05 13:57:09 +11:00
onebox/engine FIX: Latest onebox adds more attributes to links for security 2017-05-12 15:49:56 -04:00
plugin FEATURE: Let plugins register themes easily 2017-01-13 11:50:52 -05:00
scheduler Skip tests for now. 2016-06-06 18:18:12 +08:00
sidekiq Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
site_settings Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
stylesheet FIX: CDN wasn't properly applied to category background images when using S3 2017-05-22 18:37:01 +02:00
validators FEATURE: Disable minimum post length check when in PM with non human users. 2017-04-27 16:00:22 +08:00
wizard PERF: bypass wizard check after 15 topics are created 2017-05-12 10:18:43 -04:00
admin_confirmation_spec.rb SECURITY: Confirm new administrator accounts via email 2017-04-04 15:59:01 -04:00
admin_user_index_query_spec.rb Add pagination to /admin/users/list API 2017-05-12 13:28:35 -07:00
archetype_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
avatar_lookup_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
cache_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
column_dropper_spec.rb rename on_remove, on_drop 2017-05-04 14:03:17 -04:00
composer_messages_finder_spec.rb Enforce a minimum amount of posters in a topic for `get_a_room` 2017-02-28 16:47:16 -05:00
content_buffer_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
cooked_post_processor_spec.rb FIX: Don't raise an error when the img attribute cannot be found 2017-05-08 15:35:31 -04:00
crawler_detection_spec.rb Add `YandexBot` to our list of crawlers 2016-07-26 13:21:37 -04:00
current_user_spec.rb FEATURE: per client user tokens 2017-02-07 09:22:16 -05:00
directory_helper_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
discourse_diff_spec.rb FIX: Don't diplay character reference in HTML diffs (#4204) 2016-05-09 08:44:21 +02:00
discourse_event_spec.rb Make sure we reset global in specs. 2016-09-05 18:18:14 +08:00
discourse_hub_spec.rb FEATURE: Send anonymized usage statistics to Discourse if Discourse Hub can't reach the site 2017-03-28 09:07:23 +05:30
discourse_i18n_spec.rb FIX: Load translation overrides for more than one locale 2016-02-22 22:48:56 +01:00
discourse_plugin_registry_spec.rb Support for an HTML builder that can create dynamic HTML 2017-04-17 17:32:55 -04:00
discourse_plugin_spec.rb More randomly failing specs fixes. 2016-09-05 19:33:03 +08:00
discourse_redis_spec.rb FIX: Make sure Redis fallback don't fall into a permanent readonly state. 2016-11-23 11:31:20 +08:00
discourse_spec.rb Use a different Redis key when PG failover sets site to readonly mode. 2017-01-11 16:38:49 +08:00
discourse_updates_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
distributed_cache_spec.rb FIX: DistributedCache would fail serialization in some cases 2016-01-30 09:01:15 +11:00
distributed_memoizer_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
distributed_mutex_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
email_cook_spec.rb FIX: Another onebox head request 2017-05-22 17:00:19 -04:00
email_updater_spec.rb FEATURE: move more urgent emails notifications to critical queue 2016-04-07 14:39:01 +10:00
enum_spec.rb Enums that are used in tables need to be stable 2016-01-08 20:43:11 +05:30
file_helper_spec.rb Refactor `FileHelper` to use keyword arguments. 2017-05-24 13:54:26 -04:00
filter_best_posts_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
final_destination_spec.rb FIX: Always allow downloads from CDN 2017-05-23 16:32:54 -04:00
flag_query_spec.rb FIX: Don't notify or return flags on system users 2017-05-08 13:13:35 -04:00
gaps_spec.rb Wizard: Step 1 2016-09-22 09:48:58 -04:00
global_path_spec.rb FIX: when CDN assets are not in root path source maps fail 2016-02-05 13:05:47 +11:00
guardian_spec.rb FIX: Regular users shouldn't be able to invite to PMs if disabled 2017-05-19 12:57:21 -04:00
has_errors_spec.rb FIX: show proper error message when no user selected for private message 2016-05-05 18:47:08 +05:30
html_prettify_spec.rb FEATURE: stop escaping special chars in title prettify 2017-03-13 10:02:20 -04:00
html_to_markdown_spec.rb FIX: supports bare <li> when converting html to markdown 2017-05-17 15:05:11 +02:00
image_sizer_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
js_locale_helper_spec.rb FIX: admin locales were not getting converted to message format 2017-03-25 01:12:23 +05:30
json_error_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
letter_avatar_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
new_post_manager_spec.rb added tests and enabled queue when new setting is > 0 2016-09-22 14:51:36 -04:00
new_post_result_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
oneboxer_spec.rb FIX: Onebox will do a HEAD request first for redirects 2017-05-22 16:52:26 -04:00
onpdiff_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
pbkdf2_spec.rb few components with rspec3 syntax 2015-01-09 13:34:37 -03:00
pinned_check_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
post_action_creator_spec.rb cleanup post action creator 2015-12-30 20:54:51 +01:00
post_creator_spec.rb PERF: improve performance of unread queries 2017-05-25 15:07:30 -04:00
post_destroyer_spec.rb REFACTOR: Load `Post` records in batches when destroying stubs. 2017-04-25 10:19:21 +08:00
post_enqueuer_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
post_merger_spec.rb FIX: Revised post not updated correctly when merging posts. 2016-08-11 09:01:54 +08:00
post_revisor_spec.rb add specs for post ownership change without revision 2016-08-20 01:27:48 +05:30
pretty_text_spec.rb FIX: Quotes should be ignored when parsing for onebox source. 2017-04-11 15:22:21 +08:00
promotion_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
rate_limiter_spec.rb FEATURE: Warn a user when they have few likes remaining 2016-03-18 11:30:29 -04:00
redis_store_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
s3_helper_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
score_calculator_spec.rb PERF: make score calculator cheaper when site has long topics 2016-07-22 09:48:44 +10:00
search_spec.rb FIX: order:latest not working for search within topic 2017-05-24 11:24:41 -04:00
secure_session_spec.rb SECURITY: prevent reuse of password reset 2016-12-19 18:00:22 +11:00
site_setting_extension_spec.rb Support Ruby 2.4. 2017-04-15 12:29:00 +08:00
slug_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
spam_handler_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
sql_builder_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
stats_socket_spec.rb make stat socket much more robust 2017-04-21 17:12:29 -04:00
suggested_topics_builder_spec.rb correct random suggested topic selection 2016-07-04 10:34:54 +10:00
system_message_spec.rb FEATURE: automatically archive welcome messages for site_contact_user 2016-01-10 16:46:11 +11:00
table_migration_helper_spec.rb fix deploy problems due to renamed table 2017-05-12 15:17:25 -04:00
text_cleaner_spec.rb Rewrite capitalize for readability 2016-03-20 08:35:48 -04:00
text_sentinel_spec.rb FIX: allow long words if they contain periods 2016-09-13 09:15:05 +05:30
timeline_lookup_spec.rb FIX: Deleted posts were showing the wrong dates in the timeline 2016-05-31 10:51:55 -04:00
topic_creator_spec.rb FEATURE: staff can set a timer to remind them about a topic 2017-05-16 14:49:50 -04:00
topic_query_spec.rb FIX: 'read' filter in top menu showing new topics 2017-04-29 14:37:45 +05:30
topic_retriever_spec.rb FEATURE: Support for a whitelist for embeddable host paths 2016-08-23 14:56:12 -04:00
topic_view_spec.rb FEATURE: include most popular tag in page title for webcrawlers of tagged uncategorized topics 2017-02-07 16:55:42 -05:00
topics_bulk_action_spec.rb fix randomly failing specs 2017-03-27 22:47:41 +02:00
trashable_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00
trust_level_spec.rb Enums that are used in tables need to be stable 2016-01-08 20:43:11 +05:30
unread_spec.rb FIX: whisper no longer experimental 2016-12-02 17:03:31 +11:00
url_helper_spec.rb FIX: absolute URL for CDN should always be rooted with a protocol 2016-09-05 15:57:46 +10:00
user_name_suggester_spec.rb FIX: Don't suggest invalid username 2016-02-21 23:28:57 +01:00
version_spec.rb Prepare for separation of RSpec helper files 2015-12-01 20:39:42 +00:00