explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tDJx

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Sort (cost=25.11..25.12 rows=1 width=74) (actual rows= loops=)

  • Sort Key: current_locationrecord."timestamp
2. 0.000 0.000 ↓ 0.0

WindowAgg (cost=25.08..25.10 rows=1 width=74) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Sort (cost=25.08..25.08 rows=1 width=58) (actual rows= loops=)

  • Sort Key: os.location_record_id DESC
4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5.77..25.07 rows=1 width=58) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5.19..23.10 rows=1 width=46) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=4.61..21.14 rows=1 width=30) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Index Scan using uq_vehicle_id_timestamp on dashboard_locationrecord current_locationrecord (cost=0.43..8.45 rows=1 width=22) (actual rows= loops=)

  • Index Cond: ((vehicle_id = 4300) AND ("timestamp" >= '2019-08-01 00:00:00+02'::timestamp with time zone) AND ("timestamp" <= '2019-09-05 00:00:00+02'::timestamp with time zone))
  • Filter: (sat_num > 0)
8. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on dashboard_vehicleoverspeedrecord os (cost=4.18..12.64 rows=4 width=8) (actual rows= loops=)

  • Recheck Cond: (location_record_id = current_locationrecord.id)
9. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on dashboard_vehicleoverspeedrecord_location_record_id (cost=0.00..4.18 rows=4 width=0) (actual rows= loops=)

  • Index Cond: (location_record_id = current_locationrecord.id)
10. 0.000 0.000 ↓ 0.0

Limit (cost=0.58..1.95 rows=1 width=16) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.58..71,997.37 rows=52,698 width=16) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Index Scan Backward using uq_vehicle_id_timestamp on dashboard_locationrecord lr (cost=0.43..58,247.89 rows=52,698 width=16) (actual rows= loops=)

  • Index Cond: ((vehicle_id = current_locationrecord.vehicle_id) AND ("timestamp" < current_locationrecord."timestamp"))
13. 0.000 0.000 ↓ 0.0

Index Only Scan using dashboard_vehicleoverspeedrecord_location_record_id on dashboard_vehicleoverspeedrecord vos (cost=0.15..0.22 rows=4 width=8) (actual rows= loops=)

  • Index Cond: (location_record_id = lr.id)
14. 0.000 0.000 ↓ 0.0

Limit (cost=0.58..1.95 rows=1 width=16) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.58..71,997.37 rows=52,698 width=16) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Index Scan using uq_vehicle_id_timestamp on dashboard_locationrecord lr_1 (cost=0.43..58,247.89 rows=52,698 width=16) (actual rows= loops=)

  • Index Cond: ((vehicle_id = current_locationrecord.vehicle_id) AND ("timestamp" > current_locationrecord."timestamp"))
17. 0.000 0.000 ↓ 0.0

Index Only Scan using dashboard_vehicleoverspeedrecord_location_record_id on dashboard_vehicleoverspeedrecord vos_1 (cost=0.15..0.22 rows=4 width=8) (actual rows= loops=)

  • Index Cond: (location_record_id = lr_1.id)