explain.depesz.com

PostgreSQL's explain analyze made readable

Result: saVu

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 14,142.070 ↑ 1.0 25 1

Limit (cost=801,666.83..801,668.58 rows=25 width=1,775) (actual time=14,142.040..14,142.070 rows=25 loops=1)

2. 0.026 14,142.066 ↑ 7,846.6 25 1

Unique (cost=801,666.83..815,398.45 rows=196,166 width=1,775) (actual time=14,142.039..14,142.066 rows=25 loops=1)

3. 453.083 14,142.040 ↑ 7,846.6 25 1

Sort (cost=801,666.83..802,157.25 rows=196,166 width=1,775) (actual time=14,142.037..14,142.040 rows=25 loops=1)

  • Sort Key: (CASE WHEN ((road_card_item.verified = ANY ('{0,3}'::integer[])) AND (road_card_item.confirm_comment IS NULL)) THEN 0 ELSE 1 END), road_card_day.road_card_day_date, (to_char((road_card_item.veh_work_from)::interval, 'HH24:MI:SS'::text)), road_card.rc_number, (CASE WHEN (pojazd.pokazuj_nr_rejestracyjny = 1) THEN pojazd.nr_rejestracyjny ELSE ''::character varying END), road_card_item.verified, road_card_item.verified_driver, road_card_item.road_card_day_id, road_card_item.road_card_item_id, road_card_item.kierowca_id, road_card_item.counter_from, road_card_item.counter_to, (to_char((road_card_item.veh_work_to)::interval, 'HH24:MI:SS'::text)), road_card_item.dist_all, (CASE WHEN (road_card_item.work_destination_id > 0) THEN firma_cel_wyjazdu.nazwa ELSE road_card_item.work_destination_text END), ((((kierowca.imie)::text || ' '::text) || (kierowca.nazwisko)::text)), kierowca_organizacja.wymaga_akcept, kierowca_organizacja.wymaga_akcept_pojazd, kierowca_organizacja.superior_id, auser.superior_alternate_akt, auser.superior_alternate_id, (CASE WHEN ((road_card_item.verified = 0) AND (road_card_item.confirm_comment IS NOT NULL)) THEN (-1) WHEN (road_card_item.verified = 2) THEN 1 ELSE 0 END), (CASE WHEN ((road_card.is_detailed_records = 0) OR (road_card_item.verified_driver = 1)) THEN (-9999) WHEN ((road_card_item.verified_driver = 0) AND (road_card_item.verified_driver_comment IS NOT NULL)) THEN (-1) WHEN (road_card_item.verified_driver = 2) THEN 1 ELSE 0 END), road_card.is_detailed_records, (CASE WHEN ((road_card.is_detailed_records = 1) AND (road_card_item.verified_driver <> 1) AND (kierowca.auser_id = 1)) THEN 1 ELSE 0 END), ((((COALESCE(auser.surname, ''::character varying))::text || ' '::text) || (COALESCE(auser.name, ''::character varying))::text)), superior_structure.name
  • Sort Method: quicksort Memory: 15899kB
4. 114.071 13,688.957 ↑ 3.6 54,069 1

Hash Join (cost=179,066.79..633,561.66 rows=196,166 width=1,775) (actual time=12,202.809..13,688.957 rows=54,069 loops=1)

  • Hash Cond: (road_card.firma1_id = auser_firma.firma1_id)
5. 11.456 13,574.666 ↑ 3.6 54,069 1

Hash Left Join (cost=179,006.77..620,870.33 rows=196,166 width=1,779) (actual time=12,202.551..13,574.666 rows=54,069 loops=1)

  • Hash Cond: (pojazd.pojazd_id = pojazd_zatwierdzanie_jazd.pojazd_id)
6. 11.690 13,563.209 ↑ 3.6 54,069 1

Hash Left Join (cost=178,956.94..576,692.89 rows=196,166 width=1,783) (actual time=12,202.542..13,563.209 rows=54,069 loops=1)

  • Hash Cond: (road_card_item.work_destination_id = firma_cel_wyjazdu.firma_cel_wyjazdu_id)
7. 18.857 13,551.518 ↑ 3.6 54,069 1

Hash Left Join (cost=178,943.79..575,944.10 rows=196,166 width=1,267) (actual time=12,202.528..13,551.518 rows=54,069 loops=1)

  • Hash Cond: (superior_details.company_structure_id = superior_structure.firma_struktura_id)
8. 29.914 13,532.255 ↑ 3.6 54,069 1

Hash Left Join (cost=178,900.62..574,549.48 rows=196,166 width=1,245) (actual time=12,202.108..13,532.255 rows=54,069 loops=1)

  • Hash Cond: (superior_driver.kierowca_id = superior_details.kierowca_id)
9. 19.698 13,474.697 ↑ 3.6 54,069 1

Hash Left Join (cost=176,408.72..567,889.06 rows=196,166 width=1,245) (actual time=12,174.435..13,474.697 rows=54,069 loops=1)

  • Hash Cond: (auser.auser_id = superior_driver.auser_id)
10. 27.313 13,441.988 ↑ 3.6 54,069 1

Hash Left Join (cost=174,544.15..561,695.78 rows=196,166 width=1,245) (actual time=12,161.396..13,441.988 rows=54,069 loops=1)

  • Hash Cond: (kierowca_organizacja.superior_id = auser.auser_id)
11. 28.800 13,410.581 ↑ 3.6 54,069 1

Hash Join (cost=174,082.94..558,487.40 rows=196,166 width=1,220) (actual time=12,157.285..13,410.581 rows=54,069 loops=1)

  • Hash Cond: (road_card.pojazd_id = pojazd.pojazd_id)
12. 44.298 13,369.043 ↑ 3.6 54,069 1

Hash Join (cost=172,681.77..552,917.70 rows=196,166 width=1,210) (actual time=12,144.535..13,369.043 rows=54,069 loops=1)

  • Hash Cond: (road_card_item.kierowca_id = kierowca.kierowca_id)
13. 46.383 13,302.012 ↑ 3.6 54,069 1

Hash Join (cost=170,817.20..546,909.43 rows=196,167 width=1,199) (actual time=12,121.759..13,302.012 rows=54,069 loops=1)

  • Hash Cond: (road_card_item.kierowca_id = kierowca_organizacja.kierowca_id)
14. 7,055.472 13,219.872 ↑ 3.6 55,368 1

Hash Join (cost=168,325.30..540,220.67 rows=198,683 width=1,183) (actual time=12,085.963..13,219.872 rows=55,368 loops=1)

  • Hash Cond: (road_card_item.road_card_day_id = road_card_day.road_card_day_id)
  • Join Filter: (((((road_card_day.road_card_day_date)::text || ' '::text) || to_char((road_card_item.veh_work_from)::interval, 'HH24:MI:SS'::text)) >= '2019-06-01 00:00'::text) AND ((((road_card_day.road_card_day_date)::text || ' '::text) || to_char((road_card_item.veh_work_to)::interval, 'HH24:MI:SS'::text)) <= '2019-07-09 23:59'::text))
  • Rows Removed by Join Filter: 1982537
15. 2,969.723 2,969.723 ↑ 1.0 3,851,912 1

Seq Scan on road_card_item (cost=0.00..251,586.10 rows=3,984,248 width=1,163) (actual time=0.027..2,969.723 rows=3,851,912 loops=1)

  • Filter: ((verified = 0) OR ((verified = ANY ('{2,3}'::integer[])) AND (kierowca_id > 0)) OR (verified_driver = 0) OR ((verified_driver = ANY ('{2,3}'::integer[])) AND (kierowca_id > 0)))
  • Rows Removed by Filter: 26836
16. 520.712 3,194.677 ↓ 1.2 1,810,302 1

Hash (cost=148,827.82..148,827.82 rows=1,559,798 width=28) (actual time=3,194.677..3,194.677 rows=1,810,302 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 113144kB
17. 2,031.859 2,673.965 ↓ 1.2 1,810,302 1

Hash Join (cost=26,352.62..148,827.82 rows=1,559,798 width=28) (actual time=1,114.893..2,673.965 rows=1,810,302 loops=1)

  • Hash Cond: (road_card_day.road_card_id = road_card.road_card_id)
18. 382.647 382.647 ↑ 1.0 3,459,553 1

Seq Scan on road_card_day (cost=0.00..63,547.10 rows=3,466,410 width=12) (actual time=0.020..382.647 rows=3,459,553 loops=1)

19. 52.420 259.459 ↑ 1.0 248,000 1

Hash (cost=23,170.98..23,170.98 rows=254,531 width=24) (actual time=259.459..259.459 rows=248,000 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 14532kB
20. 207.039 207.039 ↑ 1.0 248,000 1

Seq Scan on road_card (cost=0.00..23,170.98 rows=254,531 width=24) (actual time=66.223..207.039 rows=248,000 loops=1)

  • Filter: ((rc_add >= '2016-10-01 00:00:00'::timestamp without time zone) AND (gps_load = 1))
  • Rows Removed by Filter: 292286
21. 10.564 35.757 ↑ 1.0 55,383 1

Hash (cost=1,786.40..1,786.40 rows=56,440 width=16) (actual time=35.757..35.757 rows=55,383 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 2597kB
22. 25.193 25.193 ↑ 1.0 55,534 1

Seq Scan on kierowca_organizacja (cost=0.00..1,786.40 rows=56,440 width=16) (actual time=0.022..25.193 rows=55,534 loops=1)

23. 9.871 22.733 ↓ 1.0 54,475 1

Hash (cost=1,183.70..1,183.70 rows=54,470 width=23) (actual time=22.733..22.733 rows=54,475 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 2778kB
24. 12.862 12.862 ↓ 1.0 54,475 1

Seq Scan on kierowca (cost=0.00..1,183.70 rows=54,470 width=23) (actual time=0.024..12.862 rows=54,475 loops=1)

25. 1.575 12.738 ↑ 1.7 8,639 1

Hash (cost=1,216.86..1,216.86 rows=14,745 width=14) (actual time=12.738..12.738 rows=8,639 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 410kB
26. 3.236 11.163 ↑ 1.7 8,639 1

Hash Right Join (cost=657.76..1,216.86 rows=14,745 width=14) (actual time=5.143..11.163 rows=8,639 loops=1)

  • Hash Cond: (pojazd_organizacja.pojazd_id = pojazd.pojazd_id)
27. 2.807 2.807 ↑ 1.0 9,347 1

Seq Scan on pojazd_organizacja (cost=0.00..360.47 rows=9,347 width=8) (actual time=0.004..2.807 rows=9,347 loops=1)

28. 1.441 5.120 ↑ 1.7 8,639 1

Hash (cost=473.45..473.45 rows=14,745 width=14) (actual time=5.120..5.120 rows=8,639 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 410kB
29. 3.679 3.679 ↑ 1.7 8,639 1

Seq Scan on pojazd (cost=0.00..473.45 rows=14,745 width=14) (actual time=0.010..3.679 rows=8,639 loops=1)

30. 1.225 4.094 ↑ 1.1 6,862 1

Hash (cost=368.87..368.87 rows=7,387 width=25) (actual time=4.094..4.094 rows=6,862 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 366kB
31. 2.869 2.869 ↑ 1.1 6,862 1

Seq Scan on auser (cost=0.00..368.87 rows=7,387 width=25) (actual time=0.006..2.869 rows=6,862 loops=1)

32. 2.791 13.011 ↑ 10.5 5,174 1

Hash (cost=1,183.70..1,183.70 rows=54,470 width=8) (actual time=13.011..13.011 rows=5,174 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 203kB
33. 10.220 10.220 ↓ 1.0 54,475 1

Seq Scan on kierowca superior_driver (cost=0.00..1,183.70 rows=54,470 width=8) (actual time=0.005..10.220 rows=54,475 loops=1)

34. 8.187 27.644 ↑ 1.0 55,383 1

Hash (cost=1,786.40..1,786.40 rows=56,440 width=12) (actual time=27.644..27.644 rows=55,383 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 2232kB
35. 19.457 19.457 ↑ 1.0 55,534 1

Seq Scan on kierowca_organizacja superior_details (cost=0.00..1,786.40 rows=56,440 width=12) (actual time=0.006..19.457 rows=55,534 loops=1)

36. 0.207 0.406 ↑ 1.0 1,163 1

Hash (cost=28.63..28.63 rows=1,163 width=30) (actual time=0.406..0.406 rows=1,163 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 74kB
37. 0.199 0.199 ↑ 1.0 1,163 1

Seq Scan on firma_struktura superior_structure (cost=0.00..28.63 rows=1,163 width=30) (actual time=0.005..0.199 rows=1,163 loops=1)

38. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=11.40..11.40 rows=140 width=520) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
39. 0.000 0.000 ↓ 0.0 0 1

Seq Scan on firma_cel_wyjazdu (cost=0.00..11.40 rows=140 width=520) (actual time=0.000..0.000 rows=0 loops=1)

40. 0.000 0.001 ↓ 0.0 0 1

Hash (cost=27.70..27.70 rows=1,770 width=4) (actual time=0.001..0.001 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
41. 0.001 0.001 ↓ 0.0 0 1

Seq Scan on pojazd_zatwierdzanie_jazd (cost=0.00..27.70 rows=1,770 width=4) (actual time=0.001..0.001 rows=0 loops=1)

42. 0.017 0.220 ↑ 1.0 23 1

Hash (cost=59.74..59.74 rows=23 width=4) (actual time=0.220..0.220 rows=23 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 7kB
43. 0.163 0.203 ↑ 1.0 23 1

Bitmap Heap Scan on auser_firma (cost=4.46..59.74 rows=23 width=4) (actual time=0.048..0.203 rows=23 loops=1)

  • Recheck Cond: (auser_id = 1)
  • Heap Blocks: exact=20
44. 0.040 0.040 ↑ 1.0 23 1

Bitmap Index Scan on auser_firma_index01 (cost=0.00..4.46 rows=23 width=0) (actual time=0.040..0.040 rows=23 loops=1)

  • Index Cond: (auser_id = 1)
Planning time : 52.002 ms
Execution time : 14,159.945 ms