akkoma/test/pleroma/web/mastodon_api/controllers
Oneric 138b1aea2f stats: use cheaper peers query
This query is one of the top cost offenders during an instances
lifetime. For small instances it was shown to take up 30-50% percent of
the total database query time, while for bigger isntaces it still held
a spot in the top 3 — alost as or even more expensive overall than
timeline queries!

The good news is, there’s a cheaper way using the instance table:
no need to process each entry, no need to filter NULLs
and no need to dedupe. EXPLAIN estimates the cost of the
old query as 13272.39 and the cost of the new query as 395.74
for me; i.e. a 33-fold reduction.

Results can slightly differ. E.g. we might have an old user
predating the instance tables existence and no interaction with since
or no instance table entry due to failure to query nodeinfo.
Conversely, we might have an instance entry but all known users got
deleted since.
However, this seems unproblematic in practice
and well worth the perf improvment.

Given the previous query didn’t exclude unreachable instances
neither does the new query.
2025-01-07 20:27:28 +01:00
..
account_controller_test.exs mastodon_api: Add /api/v1/preferences endpoint 2023-08-12 09:28:24 -04:00
announcement_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
app_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
auth_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
conversation_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
custom_emoji_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
directory_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
domain_block_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
filter_controller_test.exs Tag Mock-tests as "mocked" and run them seperately 2023-08-04 12:50:50 +01:00
follow_request_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
instance_controller_test.exs stats: use cheaper peers query 2025-01-07 20:27:28 +01:00
list_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
marker_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
media_controller_test.exs Don't try to handle non-media objects as media 2024-05-22 20:30:23 +02:00
notification_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
poll_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
report_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
scheduled_activity_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
search_controller_test.exs Hide logs during test unless a test fails 2024-06-27 18:29:45 +02:00
status_controller_test.exs Mastodon API: Remove deprecated GET /api/v1/statuses/:id/card endpoint 2024-06-09 17:38:06 +01:00
subscription_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
suggestion_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
tag_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
timeline_controller_test.exs Hide logs during test unless a test fails 2024-06-27 18:29:45 +02:00