explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GWCd

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 123,850.558 ↑ 1.0 1 1

Aggregate (cost=389,763.06..389,763.07 rows=1 width=8) (actual time=123,850.558..123,850.558 rows=1 loops=1)

2. 9.909 123,850.553 ↑ 1,372.0 3 1

Nested Loop Semi Join (cost=1.00..389,752.77 rows=4,116 width=0) (actual time=118,651.401..123,850.553 rows=3 loops=1)

3. 51.711 64.292 ↓ 2.0 8,232 1

Index Scan using line_item_client_id_indx on base_invoice bin (cost=0.29..386,434.10 rows=4,116 width=16) (actual time=9.667..64.292 rows=8,232 loops=1)

  • Index Cond: (client_id = 1005)
  • Filter: ((NOT deleted) AND (NOT saved_as_draft) AND COALESCE(NULLIF((alternatives: SubPlan 1 or hashed SubPlan 2), false), NULLIF((alternatives: SubPlan 3 or hashed SubPlan 4), false), NULLIF((alternatives: SubPlan 5 or hashed SubPlan 6), false), NULLIF((alternatives: SubPlan 7 or hashed SubPlan 8), false)))
  • Rows Removed by Filter: 133
4.          

SubPlan (forIndex Scan)

5. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..9.56 rows=1 width=0) (never executed)

  • Join Filter: (sda.data_id = ed.id)
6. 0.000 0.000 ↓ 0.0 0

Seq Scan on secondary_data_access sda (cost=0.00..1.11 rows=1 width=4) (never executed)

  • Filter: (user_id = 1257)
7. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_entity_data_entity_type_id_entity_id on entity_data ed (cost=0.42..8.44 rows=1 width=4) (never executed)

  • Index Cond: ((bin.entity_type_id = entity_type_id) AND (bin.entity_id = entity_id))
8. 0.000 0.006 ↓ 0.0 0 1

Nested Loop (cost=0.42..9.55 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=1)

9. 0.006 0.006 ↓ 0.0 0 1

Seq Scan on secondary_data_access sda_1 (cost=0.00..1.11 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=1)

  • Filter: (user_id = 1257)
  • Rows Removed by Filter: 9
10. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_entity_data on entity_data ed_1 (cost=0.42..8.44 rows=1 width=12) (never executed)

  • Index Cond: (id = sda_1.data_id)
11. 0.000 0.000 ↓ 0.0 0

Index Scan using user_data_read_access_1 on user_data_read_access udr (cost=0.42..8.28 rows=1 width=0) (never executed)

  • Index Cond: ((user_id = 1257) AND (entity_type_id = 67))
  • Filter: (entity_id = bin.id)
12. 0.010 0.010 ↓ 0.0 0 1

Index Scan using user_data_read_access_1 on user_data_read_access udr_1 (cost=0.42..8.28 rows=1 width=4) (actual time=0.010..0.010 rows=0 loops=1)

  • Index Cond: ((user_id = 1257) AND (entity_type_id = 67))
13. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.71..16.82 rows=1 width=0) (never executed)

14. 0.000 0.000 ↓ 0.0 0

Index Scan using base_invoice_pkey on base_invoice et (cost=0.29..8.30 rows=1 width=4) (never executed)

  • Index Cond: (id = bin.id)
15. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_2 (cost=0.42..8.45 rows=1 width=4) (never executed)

  • Index Cond: ((user_id = 1257) AND (entity_type_id = 61) AND (entity_id = et.contract_id))
  • Heap Fetches: 0
16. 4.959 6.734 ↓ 6.6 8,247 1

Hash Join (cost=15.74..880.62 rows=1,252 width=4) (actual time=0.429..6.734 rows=8,247 loops=1)

  • Hash Cond: (et_1.contract_id = udr_3.entity_id)
17. 1.362 1.362 ↑ 1.0 8,460 1

Seq Scan on base_invoice et_1 (cost=0.00..842.60 rows=8,460 width=8) (actual time=0.002..1.362 rows=8,460 loops=1)

18. 0.185 0.413 ↓ 4.3 971 1

Hash (cost=12.93..12.93 rows=225 width=4) (actual time=0.413..0.413 rows=971 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 43kB
19. 0.228 0.228 ↓ 4.3 971 1

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_3 (cost=0.42..12.93 rows=225 width=4) (actual time=0.029..0.228 rows=971 loops=1)

  • Index Cond: ((user_id = 1257) AND (entity_type_id = 61))
  • Heap Fetches: 1
20. 0.000 0.000 ↓ 0.0 0

Merge Join (cost=8.98..11.38 rows=1 width=0) (never executed)

  • Merge Cond: (et_2.relation_id = udr_4.entity_id)
21. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.31..8.32 rows=1 width=4) (never executed)

  • Sort Key: et_2.relation_id
22. 0.000 0.000 ↓ 0.0 0

Index Scan using base_invoice_pkey on base_invoice et_2 (cost=0.29..8.30 rows=1 width=4) (never executed)

  • Index Cond: (id = bin.id)
23. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_4 (cost=0.42..9.17 rows=37 width=4) (never executed)

  • Index Cond: ((user_id = 1257) AND (entity_type_id = 1))
  • Heap Fetches: 0
24. 4.467 5.831 ↓ 45.6 8,353 1

Hash Join (cost=9.63..874.50 rows=183 width=4) (actual time=0.150..5.831 rows=8,353 loops=1)

  • Hash Cond: (et_3.relation_id = udr_5.entity_id)
25. 1.233 1.233 ↑ 1.0 8,460 1

Seq Scan on base_invoice et_3 (cost=0.00..842.60 rows=8,460 width=8) (actual time=0.006..1.233 rows=8,460 loops=1)

26. 0.054 0.131 ↓ 7.1 262 1

Hash (cost=9.17..9.17 rows=37 width=4) (actual time=0.131..0.131 rows=262 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
27. 0.077 0.077 ↓ 7.1 262 1

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_5 (cost=0.42..9.17 rows=37 width=4) (actual time=0.022..0.077 rows=262 loops=1)

  • Index Cond: ((user_id = 1257) AND (entity_type_id = 1))
  • Heap Fetches: 1
28. 356.540 123,776.352 ↓ 0.0 0 8,232

Nested Loop (cost=0.72..199.01 rows=19,289 width=4) (actual time=15.036..15.036 rows=0 loops=8,232)

29. 452.760 452.760 ↓ 1.2 220 8,232

Index Only Scan using idx_work_flow_entity_lead_time_1 on work_flow_entity_lead_time wfelt (cost=0.43..7.70 rows=183 width=8) (actual time=0.010..0.055 rows=220 loops=8,232)

  • Index Cond: ((entity_type_id = 67) AND (entity_id = bin.id))
  • Heap Fetches: 0
30. 122,967.052 122,967.052 ↓ 0.0 0 1,808,339

Index Scan using work_flow_task_lead_time__index on work_flow_task_lead_time wftlt (cost=0.29..0.91 rows=14 width=4) (actual time=0.068..0.068 rows=0 loops=1,808,339)

  • Index Cond: (lead_time_id = wfelt.lead_time_id)
  • Filter: (lead_time_type = 3)
  • Rows Removed by Filter: 263