Skip to content

Instantly share code, notes, and snippets.

@zunda
Created September 24, 2017 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zunda/bb7e974b03dd1849601182d43f7e36ba to your computer and use it in GitHub Desktop.
Save zunda/bb7e974b03dd1849601182d43f7e36ba to your computer and use it in GitHub Desktop.
mastodon.zunda.ninjaでLTLを取得するクエリ
> EXPLAIN ANALYSE SELECT statuses.id, statuses.updated_at FROM statuses LEFT OUTER JOIN accounts a ON a.id = account_id WHERE (local = true OR statuses.uri IS NULL) AND visibility = 0 AND (reblog_of_id IS NULL) AND (not reply OR in_reply_to_account_id = account_id) AND not silenced ORDER BY statuses.id DESC LIMIT 40;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.14..323.77 rows=40 width=16) (actual time=4862.449..8725.201 rows=40 loops=1)
-> Nested Loop (cost=0.14..20947.19 rows=2589 width=16) (actual time=4862.448..8725.184 rows=40 loops=1)
-> Index Scan Backward using statuses_pkey on statuses (cost=0.08..17682.20 rows=2589 width=24) (actual time=4862.429..8724.707 rows=40 loops=1)
Filter: ((local OR (uri IS NULL)) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)) AND (visibility = 0))
Rows Removed by Filter: 4249
-> Index Scan using accounts_pkey on accounts a (cost=0.06..1.26 rows=1 width=8) (actual time=0.008..0.009 rows=1 loops=40)
Index Cond: (id = statuses.account_id)
Filter: (NOT silenced)
Planning time: 3787.027 ms
Execution time: 8725.311 ms
(10 rows)
Time: 14973.928 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment