explain.depesz.com

A tool for finding a real cause for slow queries.

Result: sfZ

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Merge Join (cost=2751752513.84..2753361945.59 rows=1745 width=8) (actual time=.. rows= loops=)

  • Merge Cond: ((g.g_device_id = gg.g_device_id) AND (g.path = gg.path) AND (g."timestamp" = gg.max_time))
2. 0.000 0.000 ↓ 0.0

Sort (cost=20822826.25..21024003.04 rows=80470715 width=16) (actual time=.. rows= loops=)

  • Sort Key: g.g_device_id, g.path, g."timestamp
3. 0.000 0.000 ↓ 0.0

Index Scan using gps_data_timestamp_indx on gps_data g (cost=0.00..3380062.55 rows=80470715 width=16) (actual time=.. rows= loops=)

4. 0.000 0.000 ↓ 0.0

Materialize (cost=2730929687.59..2731935571.53 rows=80470715 width=16) (actual time=.. rows= loops=)

5. 0.000 0.000 ↓ 0.0

Sort (cost=2730929687.59..2731130864.38 rows=80470715 width=16) (actual time=.. rows= loops=)

  • Sort Key: gg.g_device_id, gg.path, gg.max_time
6. 0.000 0.000 ↓ 0.0

Subquery Scan gg (cost=2624780882.42..2713486923.89 rows=80470715 width=16) (actual time=.. rows= loops=)

7. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=2624780882.42..2712682216.74 rows=80470715 width=16) (actual time=.. rows= loops=)

8. 0.000 0.000 ↓ 0.0

Sort (cost=2624780882.42..2642159972.49 rows=6951636031 width=16) (actual time=.. rows= loops=)

  • Sort Key: g1.id, g1.path, g1.g_device_id
9. 0.000 0.000 ↓ 0.0

Merge Join (cost=239054097.70..656755789.92 rows=6951636031 width=16) (actual time=.. rows= loops=)

  • Merge Cond: ((g1.path = g2.path) AND (g1.g_device_id = g2.g_device_id))
  • Join Filter: (g1."timestamp" > g2."timestamp")
10. 0.000 0.000 ↓ 0.0

Sort (cost=119527048.85..119728225.64 rows=80470715 width=16) (actual time=.. rows= loops=)

  • Sort Key: g1.path, g1.g_device_id
11. 0.000 0.000 ↓ 0.0

Seq Scan on gps_data g1 (cost=100000000.00..102084285.15 rows=80470715 width=16) (actual time=.. rows= loops=)

12. 0.000 0.000 ↓ 0.0

Materialize (cost=119527048.85..120532932.79 rows=80470715 width=12) (actual time=.. rows= loops=)

13. 0.000 0.000 ↓ 0.0

Sort (cost=119527048.85..119728225.64 rows=80470715 width=12) (actual time=.. rows= loops=)

  • Sort Key: g2.path, g2.g_device_id
14. 0.000 0.000 ↓ 0.0

Seq Scan on gps_data g2 (cost=100000000.00..102084285.15 rows=80470715 width=12) (actual time=.. rows= loops=)