explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WKde

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 13,575.602 ↓ 0.0 0 1

Limit (cost=586,187.01..586,188.76 rows=25 width=1,775) (actual time=13,575.602..13,575.602 rows=0 loops=1)

2. 0.000 13,575.602 ↓ 0.0 0 1

Unique (cost=586,187.01..586,282.63 rows=1,366 width=1,775) (actual time=13,575.602..13,575.602 rows=0 loops=1)

3. 0.048 13,575.602 ↓ 0.0 0 1

Sort (cost=586,187.01..586,190.42 rows=1,366 width=1,775) (actual time=13,575.602..13,575.602 rows=0 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: 25kB
4. 0.001 13,575.554 ↓ 0.0 0 1

Nested Loop Left Join (cost=176,529.26..586,115.87 rows=1,366 width=1,775) (actual time=13,575.554..13,575.554 rows=0 loops=1)

5. 0.000 13,575.553 ↓ 0.0 0 1

Nested Loop Left Join (cost=176,529.12..585,811.92 rows=1,366 width=1,259) (actual time=13,575.553..13,575.553 rows=0 loops=1)

6. 0.010 13,575.553 ↓ 0.0 0 1

Nested Loop Left Join (cost=176,528.84..585,393.06 rows=1,366 width=1,237) (actual time=13,575.553..13,575.553 rows=0 loops=1)

7. 0.001 13,575.543 ↓ 0.0 0 1

Nested Loop Left Join (cost=176,528.55..584,821.33 rows=1,366 width=1,237) (actual time=13,575.543..13,575.543 rows=0 loops=1)

8. 19.562 13,575.542 ↓ 0.0 0 1

Hash Left Join (cost=176,528.26..583,803.28 rows=1,366 width=1,237) (actual time=13,575.542..13,575.542 rows=0 loops=1)

  • Hash Cond: (road_card_item.road_card_timestamp_id = road_card_timestamps.road_card_timestamp_id)
  • Filter: (((kierowca_organizacja.wymaga_akcept = 1) AND ((CASE WHEN ((1 = kierowca_organizacja.superior_id) OR (1 = kierowca_organizacja.superior2_id) OR (1 = kierowca_organizacja.superior3_id) OR (1 = kierowca_organizacja.superior4_id) OR (1 = kierowca_organizacja.superior5_id) OR (1 = kierowca_organizacja.superior6_id) OR (1 = kierowca_organizacja.superior7_id) OR (1 = kierowca_organizacja.superior8_id)) THEN 1 ELSE 0 END = 1) OR (CASE WHEN ((auser.superior_alternate_akt = 1) AND (auser.superior_alternate_id = 1)) THEN 1 ELSE 0 END = 1) OR (CASE WHEN ((road_card_item.road_card_timestamp_id IS NOT NULL) AND ((road_card_timestamps.account)::text = '-1'::text)) THEN 1 ELSE 0 END = 1) OR (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 = 1))) OR (CASE WHEN ((kierowca_organizacja.wymaga_akcept_pojazd = 1) AND (pojazd_zatwierdzanie_jazd.auser_id = 1)) THEN 1 ELSE 0 END = 1))
  • Rows Removed by Filter: 54069
9. 12.011 13,555.979 ↑ 3.6 54,069 1

Hash Left Join (cost=176,515.34..583,054.63 rows=196,175 width=1,273) (actual time=12,278.733..13,555.979 rows=54,069 loops=1)

  • Hash Cond: (pojazd.pojazd_id = pojazd_zatwierdzanie_jazd.pojazd_id)
10. 51.591 13,543.967 ↑ 3.6 54,069 1

Hash Join (cost=176,465.51..538,875.16 rows=196,175 width=1,273) (actual time=12,278.715..13,543.967 rows=54,069 loops=1)

  • Hash Cond: (road_card_item.kierowca_id = kierowca.kierowca_id)
11. 27.784 13,369.585 ↑ 3.6 55,368 1

Hash Join (cost=169,729.99..529,432.79 rows=198,692 width=1,193) (actual time=12,155.890..13,369.585 rows=55,368 loops=1)

  • Hash Cond: (road_card.pojazd_id = pojazd.pojazd_id)
12. 7,183.028 13,330.165 ↑ 3.6 55,368 1

Hash Join (cost=168,328.82..525,299.61 rows=198,692 width=1,183) (actual time=12,144.235..13,330.165 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
13. 3,021.220 3,021.220 ↑ 1.0 3,851,912 1

Seq Scan on road_card_item (cost=0.00..251,597.70 rows=3,984,431 width=1,163) (actual time=0.022..3,021.220 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
14. 498.010 3,125.917 ↓ 1.2 1,810,302 1

Hash (cost=148,831.37..148,831.37 rows=1,559,796 width=24) (actual time=3,125.917..3,125.917 rows=1,810,302 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 106073kB
15. 1,883.779 2,627.907 ↓ 1.2 1,810,302 1

Hash Join (cost=26,356.18..148,831.37 rows=1,559,796 width=24) (actual time=1,176.607..2,627.907 rows=1,810,302 loops=1)

  • Hash Cond: (road_card_day.road_card_id = road_card.road_card_id)
16. 510.494 510.494 ↑ 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.026..510.494 rows=3,459,553 loops=1)

17. 46.784 233.634 ↑ 1.0 248,000 1

Hash (cost=23,174.12..23,174.12 rows=254,565 width=20) (actual time=233.634..233.634 rows=248,000 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 13563kB
18. 186.850 186.850 ↑ 1.0 248,000 1

Seq Scan on road_card (cost=0.00..23,174.12 rows=254,565 width=20) (actual time=46.244..186.850 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
19. 1.528 11.636 ↑ 1.7 8,639 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 410kB
20. 2.914 10.108 ↑ 1.7 8,639 1

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

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

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

22. 1.379 4.459 ↑ 1.7 8,639 1

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

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

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

24. 15.616 122.791 ↓ 1.0 54,475 1

Hash (cost=6,054.65..6,054.65 rows=54,470 width=92) (actual time=122.791..122.791 rows=54,475 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 4311kB
25. 12.383 107.175 ↓ 1.0 54,475 1

Hash Left Join (cost=2,325.78..6,054.65 rows=54,470 width=92) (actual time=26.803..107.175 rows=54,475 loops=1)

  • Hash Cond: (kierowca_organizacja.superior_id = auser.auser_id)
26. 38.475 90.260 ↓ 1.0 54,475 1

Hash Join (cost=1,864.58..4,830.62 rows=54,470 width=67) (actual time=22.257..90.260 rows=54,475 loops=1)

  • Hash Cond: (kierowca_organizacja.kierowca_id = kierowca.kierowca_id)
27. 29.590 29.590 ↑ 1.0 55,534 1

Seq Scan on kierowca_organizacja (cost=0.00..1,786.40 rows=56,440 width=44) (actual time=0.024..29.590 rows=55,534 loops=1)

28. 9.555 22.195 ↓ 1.0 54,475 1

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

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

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

30. 1.187 4.532 ↑ 1.1 6,863 1

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

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

Seq Scan on auser (cost=0.00..368.87 rows=7,387 width=25) (actual time=0.016..3.345 rows=6,863 loops=1)

32. 0.001 0.001 ↓ 0.0 0 1

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

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

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

34. 0.000 0.001 ↓ 0.0 0 1

Hash (cost=11.30..11.30 rows=130 width=520) (actual time=0.001..0.001 rows=0 loops=1)

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

Seq Scan on road_card_timestamps (cost=0.00..11.30 rows=130 width=520) (actual time=0.001..0.001 rows=0 loops=1)

36. 0.000 0.000 ↓ 0.0 0

Index Scan using kierowca_auser_id on kierowca superior_driver (cost=0.29..0.74 rows=1 width=8) (never executed)

  • Index Cond: (auser_id = auser.auser_id)
37. 0.000 0.000 ↓ 0.0 0

Index Scan using kierowca_organizacja_index01 on kierowca_organizacja superior_details (cost=0.29..0.41 rows=1 width=12) (never executed)

  • Index Cond: (kierowca_id = superior_driver.kierowca_id)
38. 0.000 0.000 ↓ 0.0 0

Index Scan using firma_struktura_pkey on firma_struktura superior_structure (cost=0.28..0.30 rows=1 width=30) (never executed)

  • Index Cond: (firma_struktura_id = superior_details.company_structure_id)
39. 0.000 0.000 ↓ 0.0 0

Index Scan using firma_cel_wyjazdu_pkey on firma_cel_wyjazdu (cost=0.14..0.16 rows=1 width=520) (never executed)

  • Index Cond: (firma_cel_wyjazdu_id = road_card_item.work_destination_id)
Planning time : 26.572 ms
Execution time : 13,588.170 ms