explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2ZCo

Settings
# exclusive inclusive rows x rows loops node
1. 1.220 41.946 ↓ 11.4 2,271 1

Hash Left Join (cost=28,857.29..29,898.25 rows=200 width=181) (actual time=29.331..41.946 rows=2,271 loops=1)

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

Nested Loop Left Join (cost=28,554.32..29,592.25 rows=200 width=116) (actual time=25.201..36.712 rows=2,271 loops=1)

3. 0.293 35.273 ↓ 11.4 2,271 1

Nested Loop Left Join (cost=28,554.03..29,426.93 rows=200 width=116) (actual time=25.198..35.273 rows=2,271 loops=1)

4. 0.462 25.896 ↓ 11.4 2,271 1

Unique (cost=28,553.61..28,594.45 rows=200 width=104) (actual time=25.179..25.896 rows=2,271 loops=1)

5. 1.158 25.434 ↑ 3.6 2,291 1

Sort (cost=28,553.61..28,574.03 rows=8,169 width=104) (actual time=25.178..25.434 rows=2,291 loops=1)

  • Sort Key: o.mobile_device_id
  • Sort Method: quicksort Memory: 276kB
6. 0.339 24.276 ↑ 3.6 2,291 1

Subquery Scan on o (cost=27,920.68..28,022.79 rows=8,169 width=104) (actual time=23.803..24.276 rows=2,291 loops=1)

7. 0.650 23.937 ↑ 3.6 2,291 1

Sort (cost=27,920.68..27,941.10 rows=8,169 width=108) (actual time=23.802..23.937 rows=2,291 loops=1)

  • Sort Key: (CASE WHEN (u.e_et_code = 'TAG'::text) THEN 1 ELSE NULL::integer END)
  • Sort Method: quicksort Memory: 276kB
8. 0.323 23.287 ↑ 3.6 2,291 1

Subquery Scan on u (cost=27,206.06..27,389.86 rows=8,169 width=108) (actual time=22.413..23.287 rows=2,291 loops=1)

9. 1.403 22.964 ↑ 3.6 2,291 1

HashAggregate (cost=27,206.06..27,287.75 rows=8,169 width=104) (actual time=22.411..22.964 rows=2,291 loops=1)

  • Group Key: nodeslogical.nl_id, tagdeviceshistory.tdh_nl_lamp_id, nodeslogical.nl_label, nodeslogical.nl_details, entities.e_et_code
10. 0.174 21.561 ↑ 3.6 2,291 1

Append (cost=250.05..27,103.94 rows=8,169 width=104) (actual time=2.559..21.561 rows=2,291 loops=1)

11. 0.007 16.479 ↑ 248.7 24 1

Result (cost=250.05..26,539.76 rows=5,968 width=40) (actual time=2.558..16.479 rows=24 loops=1)

  • One-Time Filter: $0
12.          

Initplan (for Result)

13. 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: 4
14. 4.120 16.460 ↑ 248.7 24 1

Nested Loop (cost=248.59..26,538.30 rows=5,968 width=40) (actual time=2.544..16.460 rows=24 loops=1)

15. 2.884 6.185 ↓ 1.0 6,155 1

Hash Join (cost=244.24..458.14 rows=5,968 width=36) (actual time=2.467..6.185 rows=6,155 loops=1)

  • Hash Cond: (nodeslogical.nl_e_id = entities.e_id)
16. 0.865 0.865 ↑ 1.0 9,021 1

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

17. 1.004 2.436 ↑ 1.0 6,155 1

Hash (cost=167.30..167.30 rows=6,155 width=7) (actual time=2.436..2.436 rows=6,155 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 305kB
18. 1.432 1.432 ↑ 1.0 6,155 1

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

  • Filter: (e_et_code = 'TAG'::text)
  • Rows Removed by Filter: 3,149
19. 0.000 6.155 ↓ 0.0 0 6,155

Limit (cost=4.35..4.35 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=6,155)

20. 0.000 6.155 ↓ 0.0 0 6,155

Sort (cost=4.35..4.37 rows=9 width=8) (actual time=0.001..0.001 rows=0 loops=6,155)

  • Sort Key: tagdeviceshistory.tdh_date_start DESC
  • Sort Method: top-N heapsort Memory: 25kB
21. 6.155 6.155 ↓ 0.0 0 6,155

Index Only Scan using tagdeviceshistory_pkey on tagdeviceshistory (cost=0.14..4.30 rows=9 width=8) (actual time=0.001..0.001 rows=0 loops=6,155)

  • Index Cond: (tdh_nl_personnel_id = nodeslogical.nl_id)
  • Heap Fetches: 0
22. 0.366 4.908 ↓ 1.0 2,267 1

Hash Anti Join (cost=199.95..441.64 rows=2,201 width=40) (actual time=2.075..4.908 rows=2,267 loops=1)

  • Hash Cond: (nodeslogical_1.nl_id = tagdeviceshistory_1.tdh_nl_lamp_id)
23. 1.728 4.512 ↓ 1.0 2,271 1

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

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

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

25. 0.389 2.016 ↑ 1.0 2,271 1

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

  • Buckets: 4,096 Batches: 1 Memory Usage: 122kB
26. 1.627 1.627 ↑ 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.627 rows=2,271 loops=1)

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

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
28. 0.027 0.027 ↑ 1.0 4 1

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

  • Filter: (tdh_date_end IS NULL)
  • Rows Removed by Filter: 217
29. 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)

30. 0.024 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[]))
31. 6.789 6.789 ↑ 835.0 1 2,263

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

  • Index Cond: (tmi_nl_mobile_id = o.mobile_device_id)
32. 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)

33. 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)
34. 0.032 0.032 ↓ 0.0 0 8

Index Scan Backward using tagtrackingmessagesindexed_pkey on tagtrackingmessagesindexed (cost=0.29..274.15 rows=525 width=8) (actual time=0.004..0.004 rows=0 loops=8)

  • Index Cond: ((ttmi_nl_personnel_id = o.mobile_device_id) AND (ttmi_te_code = 'TRACKING'::text))
35. 2.190 4.014 ↑ 1.0 9,021 1

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

  • Buckets: 16,384 Batches: 1 Memory Usage: 569kB
36. 1.824 1.824 ↑ 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.824 rows=9,021 loops=1)