explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 01FO

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

Limit (cost=103.71..1,419.19 rows=1 width=509) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Result (cost=103.71..1,315,590.63 rows=1,000 width=509) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

ProjectSet (cost=103.71..1,302,344.94 rows=1,000 width=737) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=103.71..1,302,339.64 rows=1 width=709) (actual rows= loops=)

  • Join Filter: (rec.event_id = events.event_id)
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=103.71..1,302,337.76 rows=1 width=648) (actual rows= loops=)

  • Join Filter: (vbsu.business_unit_id = bsu.business_unit_id)
6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=103.71..1,302,336.52 rows=1 width=580) (actual rows= loops=)

  • Join Filter: (vc.company_id = c.company_id)
7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=103.71..1,302,335.40 rows=1 width=548) (actual rows= loops=)

  • Join Filter: (v_d.vehicle_id = vbsu.vehicle_id)
8. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=103.71..1,302,334.15 rows=10 width=552) (actual rows= loops=)

  • Join Filter: (d.serial_dev = (nw.idequipo)::text)
9. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.71..1,302,054.43 rows=10 width=520) (actual rows= loops=)

  • Join Filter: (d.model_id = mod.model_id)
10. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.71..1,302,052.85 rows=10 width=488) (actual rows= loops=)

  • Join Filter: (d.device_status_id = dst.device_status_id)
11. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.71..1,302,050.64 rows=10 width=456) (actual rows= loops=)

  • Join Filter: (rec.device_id = d.device_id)
12. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.71..1,301,027.27 rows=10 width=436) (actual rows= loops=)

  • Join Filter: (v_d.vehicle_id = veh.vehicle_id)
13. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.71..1,301,013.94 rows=13 width=417) (actual rows= loops=)

  • Join Filter: (v_d.vehicle_id = vc.vehicle_id)
14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.71..1,301,006.36 rows=43 width=405) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Merge Append (cost=3.71..1,301,004.42 rows=43 width=394) (actual rows= loops=)

  • Sort Key: rec.ts_rec DESC
16. 0.000 0.000 ↓ 0.0

Index Scan Backward using udx_ts__device__records_data on records_data rec (cost=0.12..3.15 rows=1 width=92) (actual rows= loops=)

  • Index Cond: (ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone)
  • Filter: ((vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
17. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202006 on records_data_202006 rec_1 (cost=0.28..187.96 rows=1 width=438) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
18. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202005 on records_data_202005 rec_2 (cost=0.28..91.07 rows=1 width=622) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
19. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202008 on records_data_202008 rec_3 (cost=0.43..91,257.69 rows=1 width=410) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
20. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202007 on records_data_202007 rec_4 (cost=0.29..381.99 rows=1 width=512) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
21. 0.000 0.000 ↓ 0.0

Index Scan Backward using udx_ts__device__records_data_201912 on records_data_201912 rec_5 (cost=0.12..3.15 rows=1 width=92) (actual rows= loops=)

  • Index Cond: (ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone)
  • Filter: ((vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
22. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202003 on records_data_202003 rec_6 (cost=0.14..3.21 rows=1 width=92) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
23. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202001 on records_data_202001 rec_7 (cost=0.28..26.21 rows=1 width=613) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
24. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202004 on records_data_202004 rec_8 (cost=0.14..5.58 rows=1 width=271) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
25. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202009 on records_data_202009 rec_9 (cost=0.56..816,254.26 rows=24 width=399) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
26. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202002 on records_data_202002 rec_10 (cost=0.28..23.81 rows=1 width=615) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
27. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ts_rec__vehicle_device__records_data_202010 on records_data_202010 rec_11 (cost=0.56..392,765.16 rows=9 width=400) (actual rows= loops=)

  • Index Cond: ((ts_rec < '2020-10-15 06:26:00-03'::timestamp with time zone) AND (vehicle_device_id IS NOT NULL) AND (vehicle_device_id = 64))
28. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.40 rows=1 width=16) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Seq Scan on vehicles_devices v_d (cost=0.00..1.40 rows=1 width=16) (actual rows= loops=)

  • Filter: (vehicle_device_id = 64)
30. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.15 rows=10 width=12) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Seq Scan on vehicles_companies vc (cost=0.00..1.10 rows=10 width=12) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..4.67 rows=45 width=19) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Seq Scan on vehicles veh (cost=0.00..4.45 rows=45 width=19) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..568.03 rows=3,087 width=24) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Seq Scan on devices d (cost=0.00..552.60 rows=3,087 width=24) (actual rows= loops=)

  • Filter: (device_status_id <> 7)
36. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.12 rows=8 width=36) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Seq Scan on device_status dst (cost=0.00..1.08 rows=8 width=36) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.06 rows=4 width=36) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Seq Scan on models mod (cost=0.00..1.04 rows=4 width=36) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Materialize (cost=100.00..142.55 rows=930 width=64) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Foreign Scan on frg_nwequipos nw (cost=100.00..137.90 rows=930 width=64) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.10 rows=1 width=8) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Seq Scan on vehicles_business_units vbsu (cost=0.00..1.10 rows=1 width=8) (actual rows= loops=)

  • Filter: (to_date_vbsu IS NULL)
44. 0.000 0.000 ↓ 0.0

Seq Scan on companies c (cost=0.00..1.05 rows=5 width=36) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Seq Scan on business_units bsu (cost=0.00..1.11 rows=11 width=72) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Seq Scan on events (cost=0.00..1.37 rows=37 width=36) (actual rows= loops=)

47.          

SubPlan (for Result)

48. 0.000 0.000 ↓ 0.0

Aggregate (cost=11.66..11.67 rows=1 width=32) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Nested Loop (cost=9.26..11.65 rows=1 width=64) (actual rows= loops=)

  • Join Filter: (rg.geofence_id = geo.geofence_id)
50. 0.000 0.000 ↓ 0.0

Merge Join (cost=9.12..10.40 rows=1 width=8) (actual rows= loops=)

  • Merge Cond: (rg.geofence_id = gvc.geofence_id)
51. 0.000 0.000 ↓ 0.0

Index Scan using idx_records_geofence__record_id on records_geofence rg (cost=0.29..6.28 rows=5 width=4) (actual rows= loops=)

  • Index Cond: (record_id = rec.record_id)
  • Filter: ((data_rge ->> 'time_in_sum'::text) IS NOT NULL)
52. 0.000 0.000 ↓ 0.0

Sort (cost=8.83..8.86 rows=14 width=4) (actual rows= loops=)

  • Sort Key: gvc.geofence_id
53. 0.000 0.000 ↓ 0.0

Seq Scan on geofences_vehicles_companies gvc (cost=0.00..8.56 rows=14 width=4) (actual rows= loops=)

  • Filter: ((to_gvc IS NULL) AND (vehicle_company_id = vc.vehicle_company_id))
54. 0.000 0.000 ↓ 0.0

Index Scan using pk_geofences on geofences geo (cost=0.14..1.23 rows=1 width=68) (actual rows= loops=)

  • Index Cond: (geofence_id = gvc.geofence_id)