explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CO4v

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

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

  • Group Key: t.id, p.id
2. 0.020 529.523 ↑ 1.0 1 1

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

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

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

4. 8.180 367.614 ↓ 934.3 9,343 1

Nested Loop (cost=1.54..283.70 rows=10 width=29) (actual time=0.173..367.614 rows=9,343 loops=1)

  • Join Filter: ((p.document_id)::text = (document_tasks.document_id)::text)
5. 9.697 228.632 ↓ 239.6 9,343 1

Nested Loop (cost=0.98..245.91 rows=39 width=79) (actual time=0.140..228.632 rows=9,343 loops=1)

6. 144.191 144.191 ↓ 239.6 9,343 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.109..144.191 rows=9,343 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: 35700
7. 74.744 74.744 ↑ 1.0 1 9,343

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,343)

  • Index Cond: (id = (p.document_id)::text)
  • Heap Fetches: 5560
8. 130.802 130.802 ↑ 1.0 1 9,343

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.013..0.014 rows=1 loops=9,343)

  • 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: 4819
9. 158.831 158.831 ↓ 0.0 0 9,343

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.017..0.017 rows=0 loops=9,343)

  • Index Cond: (((parent_id)::text = (p.id)::text) AND ((type)::text = 'RECIPIENT'::text) AND (is_deleted = false))
  • Filter: ((NOT is_deleted) AND is_active AND (NOT draft) 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 : 3.126 ms
Execution time : 529.679 ms