explain.depesz.com

PostgreSQL's explain analyze made readable

Result: aW6J

Settings
# exclusive inclusive rows x rows loops node
1. 0.035 485.813 ↑ 1.0 1 1

Group (cost=337.54..337.56 rows=1 width=86) (actual time=485.813..485.813 rows=1 loops=1)

  • Group Key: t.id, p.id
2. 0.019 485.778 ↑ 1.0 1 1

Sort (cost=337.54..337.55 rows=1 width=54) (actual time=485.778..485.778 rows=1 loops=1)

  • Sort Key: t.id, p.id
  • Sort Method: quicksort Memory: 25kB
3. 2.462 485.759 ↑ 1.0 1 1

Nested Loop (cost=2.10..337.53 rows=1 width=54) (actual time=347.325..485.759 rows=1 loops=1)

4. 14.843 333.793 ↓ 934.4 9,344 1

Nested Loop (cost=1.54..283.70 rows=10 width=29) (actual time=0.168..333.793 rows=9,344 loops=1)

  • Join Filter: ((p.document_id)::text = (document_tasks.document_id)::text)
5. 6.188 216.166 ↓ 239.6 9,344 1

Nested Loop (cost=0.98..245.91 rows=39 width=79) (actual time=0.137..216.166 rows=9,344 loops=1)

6. 135.226 135.226 ↓ 239.6 9,344 1

Index Scan using tasks_type_draft_is_active_is_deleted_due_date_index on tasks p (cost=0.56..189.75 rows=39 width=54) (actual time=0.110..135.226 rows=9,344 loops=1)

  • Index Cond: (((type)::text = ANY ('{FOR_EXECUTION,FOR_APPEAL}'::text[])) AND (draft = false) AND (is_active = true) AND (is_deleted = false) AND (due_date IS NOT NULL) AND (due_date >= '2019-08-01'::date) AND (due_date <= '2019-08-31'::date))
  • Filter: ((NOT is_deleted) AND (NOT draft) AND is_active AND ((db_id)::text = '58db4eaa22e00b0ef61d4496'::text))
  • Rows Removed by Filter: 35699
7. 74.752 74.752 ↑ 1.0 1 9,344

Index Only Scan using documents_pkey on documents doc (cost=0.42..1.44 rows=1 width=25) (actual time=0.008..0.008 rows=1 loops=9,344)

  • Index Cond: (id = (p.document_id)::text)
  • Heap Fetches: 5561
8. 102.784 102.784 ↑ 1.0 1 9,344

Index Only Scan using tasks_document_id_db_id_type_is_deleted_index on tasks document_tasks (cost=0.56..0.96 rows=1 width=25) (actual time=0.011..0.011 rows=1 loops=9,344)

  • Index Cond: ((document_id = (doc.id)::text) AND (db_id = '58db4eaa22e00b0ef61d4496'::text) AND (type = 'ROOT_TASK'::text) AND (is_deleted = false))
  • Filter: (NOT is_deleted)
  • Heap Fetches: 4820
9. 149.504 149.504 ↓ 0.0 0 9,344

Index Scan using tasks_parent_id_type_is_deleted_index on tasks t (cost=0.56..5.37 rows=1 width=50) (actual time=0.016..0.016 rows=0 loops=9,344)

  • Index Cond: (((parent_id)::text = (p.id)::text) AND ((type)::text = 'RECIPIENT'::text) AND (is_deleted = false))
  • Filter: ((NOT draft) AND is_active AND (NOT is_deleted) AND (task_done IS NOT TRUE) AND ((db_id)::text = '58db4eaa22e00b0ef61d4496'::text) AND ((recipient_user_id)::text = '5c57e03b9708719fd30944c2'::text))
  • Rows Removed by Filter: 2
Planning time : 2.768 ms
Execution time : 485.918 ms