explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RzPc

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 1.187 25.079 ↓ 11.4 2,271 1

Hash Left Join (cost=28,858.97..29,899.93 rows=200 width=181) (actual time=12.360..25.079 rows=2,271 loops=1)

  • Hash Cond: (COALESCE(tagtrackingmessagesindexed.ttmi_nl_fixed_id, trackingmessagesindexed.tmi_nl_fixed_id) = nlf.nl_id)
2. 1.424 19.987 ↓ 11.4 2,271 1

Nested Loop Left Join (cost=28,556.00..29,593.94 rows=200 width=124) (actual time=8.371..19.987 rows=2,271 loops=1)

3. 0.465 18.563 ↓ 11.4 2,271 1

Nested Loop Left Join (cost=28,555.71..29,428.61 rows=200 width=112) (actual time=8.369..18.563 rows=2,271 loops=1)

4. 0.444 9.014 ↓ 11.4 2,271 1

Unique (cost=28,555.29..28,596.14 rows=200 width=104) (actual time=8.348..9.014 rows=2,271 loops=1)

5. 0.916 8.570 ↑ 3.6 2,271 1

Sort (cost=28,555.29..28,575.71 rows=8,170 width=104) (actual time=8.347..8.570 rows=2,271 loops=1)

  • Sort Key: o.mobile_device_id
  • Sort Method: quicksort Memory: 274kB
6. 0.329 7.654 ↑ 3.6 2,271 1

Subquery Scan on o (cost=27,922.27..28,024.39 rows=8,170 width=104) (actual time=7.197..7.654 rows=2,271 loops=1)

7. 0.569 7.325 ↑ 3.6 2,271 1

Sort (cost=27,922.27..27,942.69 rows=8,170 width=108) (actual time=7.196..7.325 rows=2,271 loops=1)

  • Sort Key: (CASE WHEN (u.e_et_code = 'TAG'::text) THEN 1 ELSE NULL::integer END)
  • Sort Method: quicksort Memory: 274kB
8. 0.319 6.756 ↑ 3.6 2,271 1

Subquery Scan on u (cost=27,207.55..27,391.38 rows=8,170 width=108) (actual time=5.906..6.756 rows=2,271 loops=1)

9. 1.308 6.437 ↑ 3.6 2,271 1

HashAggregate (cost=27,207.55..27,289.25 rows=8,170 width=104) (actual time=5.905..6.437 rows=2,271 loops=1)

  • Group Key: nodeslogical.nl_id, tagdeviceshistory.tdh_nl_lamp_id, nodeslogical.nl_label, nodeslogical.nl_details, entities.e_et_code
10. 0.180 5.129 ↑ 3.6 2,271 1

Append (cost=250.05..27,105.43 rows=8,170 width=104) (actual time=1.899..5.129 rows=2,271 loops=1)

11. 0.002 0.019 ↓ 0.0 0 1

Result (cost=250.05..26,539.76 rows=5,968 width=40) (actual time=0.018..0.019 rows=0 loops=1)

  • One-Time Filter: $0
12.          

Initplan (for Result)

13. 0.017 0.017 ↓ 0.0 0 1

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

  • Filter: (((sa_key)::text = 'enableRFID'::text) AND ((sa_value)::text = '1'::text))
  • Rows Removed by Filter: 31
14. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=248.59..26,538.30 rows=5,968 width=40) (never executed)

15. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=244.24..458.14 rows=5,968 width=36) (never executed)

  • Hash Cond: (nodeslogical.nl_e_id = entities.e_id)
16. 0.000 0.000 ↓ 0.0 0

Seq Scan on nodeslogical (cost=0.00..190.21 rows=9,021 width=37) (never executed)

17. 0.000 0.000 ↓ 0.0 0

Hash (cost=167.30..167.30 rows=6,155 width=7) (never executed)

18. 0.000 0.000 ↓ 0.0 0

Seq Scan on entities (cost=0.00..167.30 rows=6,155 width=7) (never executed)

  • Filter: (e_et_code = 'TAG'::text)
19. 0.000 0.000 ↓ 0.0 0

Limit (cost=4.35..4.35 rows=1 width=8) (never executed)

20. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.35..4.37 rows=9 width=8) (never executed)

  • Sort Key: tagdeviceshistory.tdh_date_start DESC
21. 0.000 0.000 ↓ 0.0 0

Index Only Scan using tagdeviceshistory_pkey on tagdeviceshistory (cost=0.14..4.30 rows=9 width=8) (never executed)

  • Index Cond: (tdh_nl_personnel_id = nodeslogical.nl_id)
  • Heap Fetches: 0
22. 0.365 4.930 ↓ 1.0 2,271 1

Hash Anti Join (cost=201.41..443.11 rows=2,202 width=40) (actual time=1.880..4.930 rows=2,271 loops=1)

  • Hash Cond: (nodeslogical_1.nl_id = tagdeviceshistory_1.tdh_nl_lamp_id)
  • Join Filter: $2
  • Rows Removed by Join Filter: 4
23.          

Initplan (for Hash Anti Join)

24. 0.011 0.011 ↓ 0.0 0 1

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

  • Filter: (((sa_key)::text = 'enableRFID'::text) AND ((sa_value)::text = '1'::text))
  • Rows Removed by Filter: 31
25. 1.870 4.523 ↓ 1.0 2,271 1

Hash Join (cost=195.69..409.59 rows=2,202 width=36) (actual time=1.844..4.523 rows=2,271 loops=1)

  • Hash Cond: (nodeslogical_1.nl_e_id = entities_1.e_id)
26. 0.826 0.826 ↑ 1.0 9,021 1

Seq Scan on nodeslogical nodeslogical_1 (cost=0.00..190.21 rows=9,021 width=37) (actual time=0.006..0.826 rows=9,021 loops=1)

27. 0.341 1.827 ↑ 1.0 2,271 1

Hash (cost=167.30..167.30 rows=2,271 width=7) (actual time=1.827..1.827 rows=2,271 loops=1)

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

Seq Scan on entities entities_1 (cost=0.00..167.30 rows=2,271 width=7) (actual time=0.009..1.486 rows=2,271 loops=1)

  • Filter: (e_et_code = ANY ('{PSD,VMTR}'::text[]))
  • Rows Removed by Filter: 7,033
29. 0.002 0.031 ↑ 1.0 4 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
30. 0.029 0.029 ↑ 1.0 4 1

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

  • Filter: (tdh_date_end IS NULL)
  • Rows Removed by Filter: 217
31. 2.271 9.084 ↑ 1.0 1 2,271

Limit (cost=0.42..4.13 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=2,271)

32. 0.000 6.813 ↑ 835.0 1 2,271

Result (cost=0.42..3,096.07 rows=835 width=12) (actual time=0.003..0.003 rows=1 loops=2,271)

  • One-Time Filter: (o.e_et_code = ANY ('{PSD,VMTR}'::text[]))
33. 6.813 6.813 ↑ 835.0 1 2,271

Index Scan using tmi_indextrackingmobile on trackingmessagesindexed (cost=0.42..3,096.07 rows=835 width=12) (actual time=0.003..0.003 rows=1 loops=2,271)

  • Index Cond: (tmi_nl_mobile_id = o.mobile_device_id)
34. 0.000 0.000 ↓ 0.0 0 2,271

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

35. 0.000 0.000 ↓ 0.0 0 2,271

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

  • One-Time Filter: (o.e_et_code = 'TAG'::text)
36. 0.000 0.000 ↓ 0.0 0

Index Scan Backward using tagtrackingmessagesindexed_pkey on tagtrackingmessagesindexed (cost=0.29..274.15 rows=525 width=12) (never executed)

  • Index Cond: ((ttmi_nl_personnel_id = o.mobile_details_id) AND (ttmi_te_code = 'TRACKING'::text))
37. 2.051 3.905 ↑ 1.0 9,021 1

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

  • Buckets: 16,384 Batches: 1 Memory Usage: 569kB
38. 1.854 1.854 ↑ 1.0 9,021 1

Seq Scan on nodeslogical nlf (cost=0.00..190.21 rows=9,021 width=33) (actual time=0.008..1.854 rows=9,021 loops=1)