explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YDKd

Settings
# exclusive inclusive rows x rows loops node
1. 0.023 395.736 ↑ 1.4 51 1

Unique (cost=114,298.57..114,303.64 rows=70 width=1,822) (actual time=395.710..395.736 rows=51 loops=1)

2. 0.161 395.713 ↑ 1.4 51 1

Sort (cost=114,298.57..114,298.74 rows=70 width=1,822) (actual time=395.709..395.713 rows=51 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_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 = 15055)) THEN 1 ELSE 0 END), ((CASE WHEN ((auser.auser_id IS NOT NULL) AND (((COALESCE(auser.surname, ''::character varying))::text || (COALESCE(auser.name, ''::character varying))::text) <> ''::text)) THEN (btrim((((COALESCE(auser.surname, ''::character varying))::text || ' '::text) || (COALESCE(auser.name, ''::character varying))::text)) || ' (z kart. kierowcy)'::text) ELSE ''::text END || CASE WHEN ((kierowca_organizacja.wymaga_akcept_pojazd = 1) AND (pojazd_zatwierdzanie_jazd_1.pojazd_id IS NOT NULL)) THEN COALESCE((string_agg((btrim((((COALESCE(auser_1.surname, ''::character varying))::text || ' '::text) || (COALESCE(auser_1.name, ''::character varying))::text)) || ' (z kart. pojazdu)'::text), '|'::text ORDER BY pojazd_zatwierdzanie_jazd_1.order_number)), ''::text) ELSE ''::text END)), superior_structure.name, superior_structure.firma_struktura_id
  • Sort Method: quicksort Memory: 38kB
3. 0.289 395.552 ↑ 1.4 51 1

Nested Loop (cost=18,431.66..114,296.42 rows=70 width=1,822) (actual time=384.658..395.552 rows=51 loops=1)

4. 0.038 0.038 ↑ 1.0 1 1

Index Only Scan using auser_firma_index01 on auser_firma (cost=0.29..8.30 rows=1 width=4) (actual time=0.037..0.038 rows=1 loops=1)

  • Index Cond: ((auser_id = 15055) AND (firma1_id = 106))
  • Heap Fetches: 1
5. 0.026 395.225 ↑ 1.4 51 1

Hash Left Join (cost=18,431.38..114,282.87 rows=70 width=1,826) (actual time=384.511..395.225 rows=51 loops=1)

  • Hash Cond: (pojazd_zatwierdzanie_jazd.pojazd_id = pojazd_zatwierdzanie_jazd_1.pojazd_id)
6. 0.050 395.187 ↑ 1.4 51 1

Hash Left Join (cost=17,760.88..113,609.75 rows=70 width=1,794) (actual time=384.486..395.187 rows=51 loops=1)

  • Hash Cond: (pojazd.pojazd_id = pojazd_zatwierdzanie_jazd.pojazd_id)
7. 0.029 395.135 ↑ 1.4 51 1

Nested Loop Left Join (cost=17,711.06..113,544.12 rows=70 width=1,794) (actual time=384.460..395.135 rows=51 loops=1)

8. 0.042 395.106 ↑ 1.4 51 1

Nested Loop Left Join (cost=17,710.91..113,532.04 rows=70 width=1,278) (actual time=384.456..395.106 rows=51 loops=1)

9. 0.006 394.962 ↑ 1.4 51 1

Nested Loop Left Join (cost=17,710.64..113,510.57 rows=70 width=1,251) (actual time=384.426..394.962 rows=51 loops=1)

10. 0.031 394.752 ↑ 1.4 51 1

Nested Loop Left Join (cost=17,710.35..113,481.02 rows=70 width=1,251) (actual time=384.399..394.752 rows=51 loops=1)

11. 0.021 394.568 ↑ 1.4 51 1

Nested Loop Left Join (cost=17,710.06..113,426.58 rows=70 width=1,247) (actual time=384.373..394.568 rows=51 loops=1)

12. 0.057 394.343 ↑ 1.3 51 1

Nested Loop Left Join (cost=17,709.77..113,397.68 rows=65 width=1,247) (actual time=384.324..394.343 rows=51 loops=1)

13. 0.014 394.082 ↑ 1.3 51 1

Nested Loop (cost=17,709.49..113,363.03 rows=65 width=1,222) (actual time=384.290..394.082 rows=51 loops=1)

14. 0.047 393.864 ↑ 1.3 51 1

Nested Loop (cost=17,709.20..113,341.16 rows=65 width=1,212) (actual time=384.268..393.864 rows=51 loops=1)

15. 0.000 393.613 ↑ 1.3 51 1

Nested Loop (cost=17,708.91..113,320.30 rows=65 width=1,201) (actual time=384.236..393.613 rows=51 loops=1)

16. 0.271 393.263 ↑ 13.4 51 1

Nested Loop (cost=17,708.62..113,098.99 rows=683 width=1,185) (actual time=384.170..393.263 rows=51 loops=1)

17. 4.947 389.862 ↑ 1.1 626 1

Hash Join (cost=17,708.19..108,127.15 rows=680 width=28) (actual time=383.093..389.862 rows=626 loops=1)

  • Hash Cond: (road_card_day.road_card_id = road_card.road_card_id)
18. 331.892 331.892 ↓ 1.3 12,117 1

Seq Scan on road_card_day (cost=0.00..90,327.83 rows=9,638 width=12) (actual time=330.001..331.892 rows=12,117 loops=1)

  • Filter: ((road_card_day_date >= '2020-02-01'::date) AND (road_card_day_date <= '2020-03-19'::date))
  • Rows Removed by Filter: 3859212
19. 7.981 53.023 ↑ 1.0 40,898 1

Hash (cost=17,176.97..17,176.97 rows=42,498 width=24) (actual time=53.023..53.023 rows=40,898 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 2397kB
20. 41.658 45.042 ↑ 1.0 40,898 1

Bitmap Heap Scan on road_card (cost=864.02..17,176.97 rows=42,498 width=24) (actual time=4.665..45.042 rows=40,898 loops=1)

  • Recheck Cond: (firma1_id = 106)
  • Filter: (gps_load = 1)
  • Rows Removed by Filter: 4919
  • Heap Blocks: exact=10288
21. 3.384 3.384 ↓ 1.0 46,138 1

Bitmap Index Scan on road_card_idx8 (cost=0.00..853.40 rows=45,463 width=0) (actual time=3.384..3.384 rows=46,138 loops=1)

  • Index Cond: (firma1_id = 106)
22. 3.130 3.130 ↓ 0.0 0 626

Index Scan using road_card_item_idx on road_card_item (cost=0.43..7.29 rows=2 width=1,165) (actual time=0.005..0.005 rows=0 loops=626)

  • Index Cond: (road_card_day_id = road_card_day.road_card_day_id)
  • 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: 1
23. 0.357 0.357 ↑ 1.0 1 51

Index Scan using kierowca_organizacja_index01 on kierowca_organizacja (cost=0.29..0.31 rows=1 width=16) (actual time=0.006..0.007 rows=1 loops=51)

  • Index Cond: (kierowca_id = road_card_item.kierowca_id)
  • Filter: (wymaga_akcept = 1)
24. 0.204 0.204 ↑ 1.0 1 51

Index Scan using kierowca_pkey on kierowca (cost=0.29..0.31 rows=1 width=23) (actual time=0.004..0.004 rows=1 loops=51)

  • Index Cond: (kierowca_id = road_card_item.kierowca_id)
25. 0.204 0.204 ↑ 1.0 1 51

Index Scan using pojazd_id_index on pojazd (cost=0.29..0.33 rows=1 width=14) (actual time=0.004..0.004 rows=1 loops=51)

  • Index Cond: (pojazd_id = road_card.pojazd_id)
26. 0.204 0.204 ↑ 1.0 1 51

Index Scan using auser_pkey on auser (cost=0.28..0.52 rows=1 width=25) (actual time=0.004..0.004 rows=1 loops=51)

  • Index Cond: (auser_id = kierowca_organizacja.superior_id)
27. 0.204 0.204 ↑ 1.0 1 51

Index Only Scan using pojazd_organizacja_index01 on pojazd_organizacja (cost=0.29..0.43 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=51)

  • Index Cond: (pojazd_id = pojazd.pojazd_id)
  • Heap Fetches: 51
28. 0.153 0.153 ↑ 1.0 1 51

Index Scan using kierowca_auser_id on kierowca superior_driver (cost=0.29..0.77 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=51)

  • Index Cond: (auser_id = auser.auser_id)
29. 0.204 0.204 ↑ 1.0 1 51

Index Scan using kierowca_organizacja_index01 on kierowca_organizacja superior_details (cost=0.29..0.41 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=51)

  • Index Cond: (kierowca_id = superior_driver.kierowca_id)
30. 0.102 0.102 ↑ 1.0 1 51

Index Scan using firma_struktura_pkey on firma_struktura superior_structure (cost=0.28..0.30 rows=1 width=31) (actual time=0.002..0.002 rows=1 loops=51)

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

Index Scan using firma_cel_wyjazdu_pkey on firma_cel_wyjazdu (cost=0.14..0.16 rows=1 width=520) (actual time=0.000..0.000 rows=0 loops=51)

  • Index Cond: (firma_cel_wyjazdu_id = road_card_item.work_destination_id)
32. 0.001 0.002 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
33. 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)

34. 0.000 0.012 ↓ 0.0 0 1

Hash (cost=667.99..667.99 rows=200 width=36) (actual time=0.012..0.012 rows=0 loops=1)

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

GroupAggregate (cost=632.52..665.99 rows=200 width=23) (actual time=0.012..0.012 rows=0 loops=1)

  • Group Key: pojazd_zatwierdzanie_jazd_1.pojazd_id
36. 0.011 0.011 ↓ 0.0 0 1

Sort (cost=632.52..636.94 rows=1,770 width=23) (actual time=0.011..0.011 rows=0 loops=1)

  • Sort Key: pojazd_zatwierdzanie_jazd_1.pojazd_id
  • Sort Method: quicksort Memory: 25kB
37. 0.000 0.000 ↓ 0.0 0 1

Hash Left Join (cost=471.72..537.03 rows=1,770 width=23) (actual time=0.000..0.000 rows=0 loops=1)

  • Hash Cond: (pojazd_zatwierdzanie_jazd_1.auser_id = auser_1.auser_id)
38. 0.000 0.000 ↓ 0.0 0 1

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

39. 0.000 0.000 ↓ 0.0 0

Hash (cost=381.32..381.32 rows=7,232 width=19) (never executed)

40. 0.000 0.000 ↓ 0.0 0

Seq Scan on auser auser_1 (cost=0.00..381.32 rows=7,232 width=19) (never executed)

Planning time : 10.761 ms
Execution time : 396.576 ms