explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WBU0 : Optimization for: plan #AMQW

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 1.074 31.285 ↓ 9.3 1,864 1

Hash Join (cost=9,847.21..11,421.41 rows=200 width=201) (actual time=13.728..31.285 rows=1,864 loops=1)

  • Hash Cond: (COALESCE(tagtrackingmessagesindexed.ttmi_nl_fixed_id, checkpointmessages.cm_nl_entry_id, trackingmessagesindexed.tmi_nl_fixed_id) = nlf.nl_id)
2. 1.475 26.190 ↓ 11.3 2,267 1

Nested Loop Left Join (cost=9,544.24..11,115.41 rows=200 width=132) (actual time=9.678..26.190 rows=2,267 loops=1)

3. 0.887 24.715 ↓ 11.3 2,267 1

Nested Loop Left Join (cost=9,543.95..10,950.08 rows=200 width=120) (actual time=9.675..24.715 rows=2,267 loops=1)

4. 2.145 19.294 ↓ 11.3 2,267 1

Nested Loop Left Join (cost=9,543.66..10,387.01 rows=200 width=116) (actual time=9.667..19.294 rows=2,267 loops=1)

5. 0.453 10.348 ↓ 11.3 2,267 1

Unique (cost=9,543.23..9,556.30 rows=200 width=104) (actual time=9.651..10.348 rows=2,267 loops=1)

6. 0.932 9.895 ↑ 1.1 2,280 1

Sort (cost=9,543.23..9,549.77 rows=2,613 width=104) (actual time=9.650..9.895 rows=2,280 loops=1)

  • Sort Key: o.mobile_device_id
  • Sort Method: quicksort Memory: 275kB
7. 0.348 8.963 ↑ 1.1 2,280 1

Subquery Scan on o (cost=9,362.26..9,394.93 rows=2,613 width=104) (actual time=8.486..8.963 rows=2,280 loops=1)

8. 0.595 8.615 ↑ 1.1 2,280 1

Sort (cost=9,362.26..9,368.80 rows=2,613 width=108) (actual time=8.485..8.615 rows=2,280 loops=1)

  • Sort Key: (CASE WHEN (u.e_et_code = 'TAG'::text) THEN 1 ELSE NULL::integer END)
  • Sort Method: quicksort Memory: 275kB
9. 0.334 8.020 ↑ 1.1 2,280 1

Subquery Scan on u (cost=9,155.16..9,213.96 rows=2,613 width=108) (actual time=7.224..8.020 rows=2,280 loops=1)

10. 1.288 7.686 ↑ 1.1 2,280 1

HashAggregate (cost=9,155.16..9,181.29 rows=2,613 width=104) (actual time=7.222..7.686 rows=2,280 loops=1)

  • Group Key: nodeslogical.nl_id, tagdeviceshistory.tdh_nl_lamp_id, nodeslogical.nl_label, nodeslogical.nl_details, entities.e_et_code
11. 0.180 6.398 ↑ 1.1 2,280 1

Append (cost=229.42..9,122.50 rows=2,613 width=104) (actual time=1.552..6.398 rows=2,280 loops=1)

12. 0.005 3.584 ↑ 119.3 16 1

Result (cost=229.42..8,776.88 rows=1,909 width=40) (actual time=1.552..3.584 rows=16 loops=1)

  • One-Time Filter: $0
13.          

Initplan (for Result)

14. 0.012 0.012 ↑ 1.0 1 1

Seq Scan on serveradmin (cost=0.00..1.46 rows=1 width=0) (actual time=0.012..0.012 rows=1 loops=1)

  • Filter: (((sa_key)::text = 'enableRFID'::text) AND ((sa_value)::text = '1'::text))
  • Rows Removed by Filter: 20
15. 0.016 3.567 ↑ 119.3 16 1

Nested Loop (cost=227.96..8,775.41 rows=1,909 width=40) (actual time=1.537..3.567 rows=16 loops=1)

16. 0.700 3.459 ↑ 83.0 23 1

Hash Join (cost=223.61..433.08 rows=1,909 width=36) (actual time=1.519..3.459 rows=23 loops=1)

  • Hash Cond: (entities.e_id = nodeslogical.nl_e_id)
17. 1.274 1.274 ↑ 1.0 6,155 1

Seq Scan on entities (cost=0.00..167.30 rows=6,155 width=7) (actual time=0.021..1.274 rows=6,155 loops=1)

  • Filter: (e_et_code = 'TAG'::text)
  • Rows Removed by Filter: 3,149
18. 0.583 1.485 ↑ 1.0 2,885 1

Hash (cost=187.55..187.55 rows=2,885 width=37) (actual time=1.484..1.485 rows=2,885 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 180kB
19. 0.902 0.902 ↑ 1.0 2,885 1

Index Scan using nl_index_isactive on nodeslogical (cost=0.28..187.55 rows=2,885 width=37) (actual time=0.014..0.902 rows=2,885 loops=1)

20. 0.000 0.092 ↑ 1.0 1 23

Limit (cost=4.35..4.35 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=23)

21. 0.046 0.092 ↑ 9.0 1 23

Sort (cost=4.35..4.37 rows=9 width=8) (actual time=0.004..0.004 rows=1 loops=23)

  • Sort Key: tagdeviceshistory.tdh_date_start DESC
  • Sort Method: top-N heapsort Memory: 25kB
22. 0.046 0.046 ↑ 2.2 4 23

Index Only Scan using tagdeviceshistory_pkey on tagdeviceshistory (cost=0.14..4.30 rows=9 width=8) (actual time=0.001..0.002 rows=4 loops=23)

  • Index Cond: (tdh_nl_personnel_id = nodeslogical.nl_id)
  • Heap Fetches: 0
23. 0.377 2.634 ↓ 3.2 2,264 1

Hash Anti Join (cost=102.70..306.43 rows=704 width=40) (actual time=0.814..2.634 rows=2,264 loops=1)

  • Hash Cond: (nodeslogical_1.nl_id = tagdeviceshistory_1.tdh_nl_lamp_id)
  • Join Filter: $2
24.          

Initplan (for Hash Anti Join)

25. 0.010 0.010 ↑ 1.0 1 1

Seq Scan on serveradmin serveradmin_1 (cost=0.00..1.46 rows=1 width=0) (actual time=0.010..0.010 rows=1 loops=1)

  • Filter: (((sa_key)::text = 'enableRFID'::text) AND ((sa_value)::text = '1'::text))
  • Rows Removed by Filter: 20
26. 0.877 2.215 ↓ 3.2 2,268 1

Hash Join (cost=96.97..291.82 rows=704 width=36) (actual time=0.776..2.215 rows=2,268 loops=1)

  • Hash Cond: (nodeslogical_1.nl_e_id = entities_1.e_id)
27. 0.580 0.580 ↑ 1.0 2,885 1

Index Scan using nl_index_isactive on nodeslogical nodeslogical_1 (cost=0.28..187.55 rows=2,885 width=37) (actual time=0.009..0.580 rows=2,885 loops=1)

28. 0.328 0.758 ↑ 1.0 2,271 1

Hash (cost=68.31..68.31 rows=2,271 width=7) (actual time=0.757..0.758 rows=2,271 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 122kB
29. 0.430 0.430 ↑ 1.0 2,271 1

Index Only Scan using e_index_et_code on entities entities_1 (cost=0.29..68.31 rows=2,271 width=7) (actual time=0.028..0.430 rows=2,271 loops=1)

  • Index Cond: (e_et_code = ANY ('{PSD,VMTR}'::text[]))
  • Heap Fetches: 0
30. 0.002 0.032 ↑ 1.0 4 1

Hash (cost=4.21..4.21 rows=4 width=4) (actual time=0.032..0.032 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
31. 0.030 0.030 ↑ 1.0 4 1

Seq Scan on tagdeviceshistory tagdeviceshistory_1 (cost=0.00..4.21 rows=4 width=4) (actual time=0.017..0.030 rows=4 loops=1)

  • Filter: (tdh_date_end IS NULL)
  • Rows Removed by Filter: 217
32. 0.000 6.801 ↑ 1.0 1 2,267

Limit (cost=0.42..4.12 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=2,267)

33. 6.801 6.801 ↑ 832.0 1 2,267

Index Scan using tmi_indextrackingmobile on trackingmessagesindexed (cost=0.42..3,077.61 rows=832 width=12) (actual time=0.003..0.003 rows=1 loops=2,267)

  • Index Cond: (tmi_nl_mobile_id = o.mobile_device_id)
34. 2.267 4.534 ↓ 0.0 0 2,267

Limit (cost=0.29..2.80 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=2,267)

35. 2.267 2.267 ↓ 0.0 0 2,267

Index Scan Backward using checkpointmessages_pkey on checkpointmessages (cost=0.29..77.88 rows=31 width=8) (actual time=0.001..0.001 rows=0 loops=2,267)

  • Index Cond: ((cm_nl_mobile_id = o.mobile_device_id) AND (cm_date >= COALESCE(trackingmessagesindexed.tmi_disconnect, 0)))
36. 0.000 0.000 ↓ 0.0 0 2,267

Limit (cost=0.29..0.81 rows=1 width=12) (actual time=0.000..0.000 rows=0 loops=2,267)

37. 0.000 0.000 ↓ 0.0 0 2,267

Result (cost=0.29..274.15 rows=525 width=12) (actual time=0.000..0.000 rows=0 loops=2,267)

  • One-Time Filter: (o.e_et_code = 'TAG'::text)
38. 0.070 0.070 ↑ 525.0 1 7

Index Scan Backward using tagtrackingmessagesindexed_pkey on tagtrackingmessagesindexed (cost=0.29..274.15 rows=525 width=12) (actual time=0.010..0.010 rows=1 loops=7)

  • Index Cond: ((ttmi_nl_personnel_id = o.mobile_details_id) AND (ttmi_te_code = 'TRACKING'::text))
39. 1.761 4.021 ↑ 1.0 9,021 1

Hash (cost=190.21..190.21 rows=9,021 width=53) (actual time=4.021..4.021 rows=9,021 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 570kB
40. 2.260 2.260 ↑ 1.0 9,021 1

Seq Scan on nodeslogical nlf (cost=0.00..190.21 rows=9,021 width=53) (actual time=0.013..2.260 rows=9,021 loops=1)