explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kmQk

Settings
# exclusive inclusive rows x rows loops node
1. 0.032 3,305.659 ↑ 1,371.0 3 1

Nested Loop Left Join (cost=310.93..439,028.93 rows=4,113 width=761) (actual time=26.406..3,305.659 rows=3 loops=1)

2. 0.004 3,305.615 ↑ 1,371.0 3 1

Nested Loop Left Join (cost=310.79..438,267.66 rows=4,113 width=624) (actual time=26.375..3,305.615 rows=3 loops=1)

3. 0.004 3,305.596 ↑ 1,371.0 3 1

Nested Loop Left Join (cost=310.50..436,705.86 rows=4,113 width=610) (actual time=26.363..3,305.596 rows=3 loops=1)

4. 0.005 3,305.580 ↑ 1,371.0 3 1

Nested Loop Left Join (cost=310.23..435,433.46 rows=4,113 width=592) (actual time=26.355..3,305.580 rows=3 loops=1)

5. 5.991 3,305.557 ↑ 1,371.0 3 1

Nested Loop Semi Join (cost=310.09..434,775.68 rows=4,113 width=80) (actual time=26.340..3,305.557 rows=3 loops=1)

6. 40.032 56.158 ↓ 2.0 8,232 1

Index Scan Backward using idx_base_invoice_cltid_cltseqid on base_invoice bin (cost=0.29..433,813.52 rows=4,113 width=84) (actual time=12.223..56.158 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
7.          

SubPlan (forIndex Scan Backward)

8. 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)
9. 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)
10. 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))
11. 0.001 0.010 ↓ 0.0 0 1

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

12. 0.009 0.009 ↓ 0.0 0 1

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

  • Filter: (user_id = 1257)
  • Rows Removed by Filter: 9
13. 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)
14. 0.000 0.000 ↓ 0.0 0

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

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

Index Scan using user_data_read_access_entity_details on user_data_read_access udr_1 (cost=0.42..8.45 rows=1 width=4) (actual time=0.018..0.018 rows=0 loops=1)

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

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

17. 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)
18. 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
19. 3.730 9.579 ↓ 1.6 8,247 1

Hash Join (cost=2,341.00..3,205.81 rows=5,127 width=4) (actual time=2.517..9.579 rows=8,247 loops=1)

  • Hash Cond: (et_1.contract_id = udr_3.entity_id)
20. 3.344 3.344 ↓ 1.0 8,460 1

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

21. 0.190 2.505 ↓ 1.1 971 1

Hash (cost=2,329.87..2,329.87 rows=891 width=4) (actual time=2.504..2.505 rows=971 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 43kB
22. 2.214 2.315 ↓ 1.1 971 1

Bitmap Heap Scan on user_data_read_access udr_3 (cost=21.56..2,329.87 rows=891 width=4) (actual time=0.157..2.315 rows=971 loops=1)

  • Recheck Cond: ((user_id = 1257) AND (entity_type_id = 61))
  • Heap Blocks: exact=379
23. 0.101 0.101 ↓ 1.1 973 1

Bitmap Index Scan on user_data_read_access_1 (cost=0.00..21.34 rows=891 width=0) (actual time=0.101..0.101 rows=973 loops=1)

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

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

25. 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)
26. 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..8.45 rows=1 width=4) (never executed)

  • Index Cond: ((user_id = 1257) AND (entity_type_id = 1) AND (entity_id = et_2.relation_id))
  • Heap Fetches: 0
27. 4.569 6.519 ↓ 7.8 8,353 1

Hash Join (cost=529.83..1,394.64 rows=1,072 width=4) (actual time=0.526..6.519 rows=8,353 loops=1)

  • Hash Cond: (et_3.relation_id = udr_5.entity_id)
28. 1.437 1.437 ↓ 1.0 8,460 1

Seq Scan on base_invoice et_3 (cost=0.00..842.54 rows=8,454 width=8) (actual time=0.004..1.437 rows=8,460 loops=1)

29. 0.039 0.513 ↓ 1.7 262 1

Hash (cost=527.94..527.94 rows=151 width=4) (actual time=0.513..0.513 rows=262 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
30. 0.453 0.474 ↓ 1.7 262 1

Bitmap Heap Scan on user_data_read_access udr_5 (cost=5.97..527.94 rows=151 width=4) (actual time=0.038..0.474 rows=262 loops=1)

  • Recheck Cond: ((user_id = 1257) AND (entity_type_id = 1))
  • Heap Blocks: exact=106
31. 0.021 0.021 ↓ 1.7 262 1

Bitmap Index Scan on user_data_read_access_1 (cost=0.00..5.93 rows=151 width=0) (actual time=0.021..0.021 rows=262 loops=1)

  • Index Cond: ((user_id = 1257) AND (entity_type_id = 1))
32. 244.290 3,243.408 ↓ 0.0 0 8,232

Hash Join (cost=309.81..708.46 rows=19,193 width=4) (actual time=0.394..0.394 rows=0 loops=8,232)

  • Hash Cond: (wfelt.lead_time_id = wftlt.lead_time_id)
33. 2,996.448 2,996.448 ↓ 1.2 220 8,232

Index Scan using idx_work_flow_entity_lead_time_entity on work_flow_entity_lead_time wfelt (cost=0.43..50.40 rows=182 width=8) (actual time=0.012..0.364 rows=220 loops=8,232)

  • Index Cond: ((entity_type_id = 67) AND (entity_id = bin.id))
34. 0.566 2.670 ↑ 1.0 3,781 1

Hash (cost=262.11..262.11 rows=3,781 width=4) (actual time=2.669..2.670 rows=3,781 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 165kB
35. 2.104 2.104 ↑ 1.0 3,781 1

Seq Scan on work_flow_task_lead_time wftlt (cost=0.00..262.11 rows=3,781 width=4) (actual time=0.013..2.104 rows=3,781 loops=1)

  • Filter: (lead_time_type = 3)
  • Rows Removed by Filter: 4548
36. 0.018 0.018 ↑ 1.0 1 3

Index Scan using pk_tier on tier t (cost=0.14..0.16 rows=1 width=520) (actual time=0.006..0.006 rows=1 loops=3)

  • Index Cond: (id = bin.tier_id)
37. 0.012 0.012 ↑ 1.0 1 3

Index Scan using pk_relation on relation re (cost=0.27..0.31 rows=1 width=22) (actual time=0.004..0.004 rows=1 loops=3)

  • Index Cond: (bin.relation_id = id)
38. 0.015 0.015 ↑ 1.0 1 3

Index Scan using pk_work_flow_status on work_flow_status ets (cost=0.28..0.38 rows=1 width=22) (actual time=0.005..0.005 rows=1 loops=3)

  • Index Cond: (bin.status_id = id)
39. 0.012 0.012 ↑ 1.0 1 3

Index Scan using pk_currency on currency cy (cost=0.14..0.16 rows=1 width=24) (actual time=0.004..0.004 rows=1 loops=3)

  • Index Cond: (bin.currency_id = id)