Created
October 12, 2017 14:20
-
-
Save tateisu/945ea7229060390e6eebb32033bd523d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT "statuses"."id", "statuses"."updated_at" FROM "statuses" | |
WHERE "statuses"."account_id" = 1 AND ("statuses"."visibility" IN (0,1,2) OR exists(select id from mentions where mentions.account_id = 1867 and mentions.status_id = statuses.id)) | |
ORDER BY "statuses"."id" DESC LIMIT 40; | |
-------------------------------------------------------------- | |
Analyze | |
Limit (cost=0.43..497.99 rows=40 width=16) (actual time=0.079..1.090 rows=40 loops=1) | |
-> Index Scan Backward using index_statuses_on_account_id_id on statuses (cost=0.43..5398.96 rows=434 width=16) (actual time=0.076..1.036 rows=40 loops=1) | |
Index Cond: (account_id = 1) | |
Filter: ((visibility = ANY ('{0,1,2}'::integer[])) OR (alternatives: SubPlan 1 or hashed SubPlan 2)) | |
Rows Removed by Filter: 1 | |
SubPlan 1 | |
-> Index Only Scan using index_mentions_on_account_id_and_status_id on mentions (cost=0.42..8.45 rows=1 width=0) (never executed) | |
Index Cond: ((account_id = 1867) AND (status_id = statuses.id)) | |
Heap Fetches: 0 | |
SubPlan 2 | |
-> Index Only Scan using index_mentions_on_account_id_and_status_id on mentions mentions_1 (cost=0.42..96.50 rows=60 width=8) (actual time=0.226..0.272 rows=23 loops=1) | |
Index Cond: (account_id = 1867) | |
Heap Fetches: 4 | |
Planning time: 0.310 ms | |
Execution time: 1.426 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment