explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KFQv

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

Result (cost=164,763.52..318,430.43 rows=4,000 width=638) (actual rows= loops=)

  • Functions: 162
2. 0.000 0.000 ↓ 0.0

ProjectSet (cost=164,763.52..290,340.43 rows=4,000 width=838) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=164,763.52..290,319.41 rows=4 width=810) (actual rows= loops=)

  • Hash Cond: (rec.event_id = events.event_id)
4. 0.000 0.000 ↓ 0.0

Hash Join (cost=164,761.69..290,317.57 rows=4 width=778) (actual rows= loops=)

  • Hash Cond: (v_d.vehicle_id = vc.vehicle_id)
5. 0.000 0.000 ↓ 0.0

Hash Join (cost=164,757.20..289,977.70 rows=82,555 width=674) (actual rows= loops=)

  • Hash Cond: (v_d.vehicle_id = veh.vehicle_id)
6. 0.000 0.000 ↓ 0.0

Hash Join (cost=164,754.19..289,737.57 rows=82,555 width=655) (actual rows= loops=)

  • Hash Cond: (d.model_id = mod.model_id)
7. 0.000 0.000 ↓ 0.0

Hash Join (cost=164,753.10..289,290.16 rows=82,555 width=623) (actual rows= loops=)

  • Hash Cond: (d.device_status_id = dst.device_status_id)
8. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=164,751.92..288,957.48 rows=82,555 width=591) (actual rows= loops=)

  • Hash Cond: (rec.position_id = positions.position_id)
9. 0.000 0.000 ↓ 0.0

Hash Join (cost=692.57..75,220.42 rows=82,555 width=499) (actual rows= loops=)

  • Hash Cond: (rec.vehicle_device_id = v_d.vehicle_device_id)
10. 0.000 0.000 ↓ 0.0

Nested Loop (cost=690.84..30,959.07 rows=16,510,930 width=491) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=690.84..741.52 rows=3,073 width=65) (actual rows= loops=)

  • Hash Cond: ((nw.idequipo)::text = d.serial_dev)
12. 0.000 0.000 ↓ 0.0

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

13. 0.000 0.000 ↓ 0.0

Hash (cost=552.42..552.42 rows=3,073 width=33) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Seq Scan on devices d (cost=0.00..552.42 rows=3,073 width=33) (actual rows= loops=)

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

Append (cost=0.00..9.78 rows=5 width=434) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Seq Scan on records_data rec (cost=0.00..0.00 rows=1 width=124) (actual rows= loops=)

  • Filter: ((ts_rec > '2020-10-01 00:00:00-03'::timestamp with time zone) AND (d.record_id = record_id))
17. 0.000 0.000 ↓ 0.0

Index Scan using pk_records_data_201912 on records_data_201912 rec_1 (cost=0.12..0.90 rows=1 width=124) (actual rows= loops=)

  • Index Cond: (record_id = d.record_id)
  • Filter: (ts_rec > '2020-10-01 00:00:00-03'::timestamp with time zone)
18. 0.000 0.000 ↓ 0.0

Index Scan using udx_ts__device__records_data_202009 on records_data_202009 rec_2 (cost=0.56..2.74 rows=1 width=431) (actual rows= loops=)

  • Index Cond: (ts_rec > '2020-10-01 00:00:00-03'::timestamp with time zone)
  • Filter: (d.record_id = record_id)
19. 0.000 0.000 ↓ 0.0

Index Scan using pk_records_data_202002 on records_data_202002 rec_3 (cost=0.28..2.71 rows=1 width=647) (actual rows= loops=)

  • Index Cond: (record_id = d.record_id)
  • Filter: (ts_rec > '2020-10-01 00:00:00-03'::timestamp with time zone)
20. 0.000 0.000 ↓ 0.0

Index Scan using pk_records_data_202010 on records_data_202010 rec_4 (cost=0.43..3.41 rows=1 width=434) (actual rows= loops=)

  • Index Cond: (record_id = d.record_id)
  • Filter: (ts_rec > '2020-10-01 00:00:00-03'::timestamp with time zone)
21. 0.000 0.000 ↓ 0.0

Hash (cost=1.72..1.72 rows=1 width=8) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

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

  • Filter: ((to_date_ved IS NULL) AND (vehicle_id = ANY ('{72,73,74,75,81,82,83,84,85,86}'::integer[])))
23. 0.000 0.000 ↓ 0.0

Hash (cost=94,185.71..94,185.71 rows=2,484,371 width=100) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Seq Scan on positions (cost=0.00..94,185.71 rows=2,484,371 width=100) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Hash (cost=1.08..1.08 rows=8 width=36) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

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

27. 0.000 0.000 ↓ 0.0

Hash (cost=1.04..1.04 rows=4 width=36) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

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

29. 0.000 0.000 ↓ 0.0

Hash (cost=2.45..2.45 rows=45 width=19) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

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

31. 0.000 0.000 ↓ 0.0

Hash (cost=4.48..4.48 rows=1 width=116) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..4.48 rows=1 width=116) (actual rows= loops=)

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

Nested Loop (cost=0.00..3.33 rows=1 width=52) (actual rows= loops=)

  • Join Filter: (vc.vehicle_id = vbsu.vehicle_id)
34. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..2.21 rows=1 width=44) (actual rows= loops=)

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

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

  • Filter: (to_date_veco IS NULL)
36. 0.000 0.000 ↓ 0.0

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

37. 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)
38. 0.000 0.000 ↓ 0.0

Seq Scan on business_units bsu (cost=0.00..1.14 rows=1 width=68) (actual rows= loops=)

  • Filter: (company_id = 2)
39. 0.000 0.000 ↓ 0.0

Hash (cost=1.37..1.37 rows=37 width=36) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

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

41.          

SubPlan (for Result)

42. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.02..3.78 rows=1 width=32) (actual rows= loops=)

  • Hash Cond: (people.person_id = dvc.person_id)
43. 0.000 0.000 ↓ 0.0

Seq Scan on people (cost=0.00..2.54 rows=54 width=18) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Hash (cost=1.01..1.01 rows=1 width=4) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Seq Scan on drivers_vehicles_companies dvc (cost=0.00..1.01 rows=1 width=4) (actual rows= loops=)

  • Filter: ((to_dvc IS NULL) AND (vehicle_company_id = vc.vehicle_company_id))
46. 0.000 0.000 ↓ 0.0

Limit (cost=1.41..1.41 rows=1 width=8) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Sort (cost=1.41..1.41 rows=1 width=8) (actual rows= loops=)

  • Sort Key: vd.ts_added_ved
48. 0.000 0.000 ↓ 0.0

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

  • Filter: (vehicle_device_id = v_d.vehicle_device_id)