explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GRDD

Settings
# exclusive inclusive rows x rows loops node
1. 0.024 356.720 ↑ 1.6 51 1

Unique (cost=114,977.84..114,983.64 rows=80 width=1,822) (actual time=356.695..356.720 rows=51 loops=1)

2. 0.118 356.696 ↑ 1.6 51 1

Sort (cost=114,977.84..114,978.04 rows=80 width=1,822) (actual time=356.694..356.696 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.166 356.578 ↑ 1.6 51 1

Nested Loop (cost=18,444.67..114,975.31 rows=80 width=1,822) (actual time=348.678..356.578 rows=51 loops=1)

4. 0.012 0.012 ↑ 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.011..0.012 rows=1 loops=1)

  • Index Cond: ((auser_id = 15055) AND (firma1_id = 106))
  • Heap Fetches: 1
5. 0.020 356.400 ↑ 1.6 51 1

Hash Left Join (cost=18,444.38..114,961.00 rows=80 width=1,826) (actual time=348.630..356.400 rows=51 loops=1)

  • Hash Cond: (pojazd_zatwierdzanie_jazd.pojazd_id = pojazd_zatwierdzanie_jazd_1.pojazd_id)
6. 0.021 356.368 ↑ 1.6 51 1

Hash Left Join (cost=17,773.89..114,287.51 rows=80 width=1,794) (actual time=348.607..356.368 rows=51 loops=1)

  • Hash Cond: (pojazd.pojazd_id = pojazd_zatwierdzanie_jazd.pojazd_id)
7. 0.028 356.346 ↑ 1.6 51 1

Hash Left Join (cost=17,724.06..114,219.62 rows=80 width=1,794) (actual time=348.596..356.346 rows=51 loops=1)

  • Hash Cond: (road_card_item.work_destination_id = firma_cel_wyjazdu.firma_cel_wyjazdu_id)
8. 0.050 356.318 ↑ 1.6 51 1

Nested Loop Left Join (cost=17,710.91..114,206.16 rows=80 width=1,278) (actual time=348.581..356.318 rows=51 loops=1)

9. 0.006 356.217 ↑ 1.6 51 1

Nested Loop Left Join (cost=17,710.64..114,181.62 rows=80 width=1,251) (actual time=348.565..356.217 rows=51 loops=1)

10. 0.003 356.109 ↑ 1.6 51 1

Nested Loop Left Join (cost=17,710.35..114,147.85 rows=80 width=1,251) (actual time=348.557..356.109 rows=51 loops=1)

11. 0.034 356.004 ↑ 1.6 51 1

Nested Loop Left Join (cost=17,710.06..114,085.63 rows=80 width=1,247) (actual time=348.547..356.004 rows=51 loops=1)

12. 0.019 355.868 ↑ 1.5 51 1

Nested Loop Left Join (cost=17,709.77..114,052.73 rows=74 width=1,247) (actual time=348.535..355.868 rows=51 loops=1)

13. 0.035 355.747 ↑ 1.5 51 1

Nested Loop (cost=17,709.49..114,013.28 rows=74 width=1,222) (actual time=348.526..355.747 rows=51 loops=1)

14. 0.032 355.610 ↑ 1.5 51 1

Nested Loop (cost=17,709.20..113,988.38 rows=74 width=1,212) (actual time=348.517..355.610 rows=51 loops=1)

15. 0.014 355.476 ↑ 1.5 51 1

Nested Loop (cost=17,708.91..113,964.64 rows=74 width=1,201) (actual time=348.507..355.476 rows=51 loops=1)

16. 0.056 355.309 ↑ 15.3 51 1

Nested Loop (cost=17,708.62..113,712.54 rows=778 width=1,185) (actual time=348.493..355.309 rows=51 loops=1)

17. 3.863 353.375 ↑ 1.2 626 1

Hash Join (cost=17,708.19..108,143.86 rows=775 width=28) (actual time=347.808..353.375 rows=626 loops=1)

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

Seq Scan on road_card_day (cost=0.00..90,331.80 rows=10,985 width=12) (actual time=299.331..301.107 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. 9.425 48.405 ↑ 1.0 40,898 1

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

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

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

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

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

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

Index Scan using road_card_item_idx on road_card_item (cost=0.43..7.17 rows=2 width=1,165) (actual time=0.003..0.003 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.153 0.153 ↑ 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.003..0.003 rows=1 loops=51)

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

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

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

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

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

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

  • Index Cond: (auser_id = kierowca_organizacja.superior_id)
27. 0.102 0.102 ↑ 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.002..0.002 rows=1 loops=51)

  • Index Cond: (pojazd_id = pojazd.pojazd_id)
  • Heap Fetches: 51
28. 0.102 0.102 ↑ 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.001..0.002 rows=1 loops=51)

  • Index Cond: (auser_id = auser.auser_id)
29. 0.102 0.102 ↑ 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.002..0.002 rows=1 loops=51)

  • Index Cond: (kierowca_id = superior_driver.kierowca_id)
30. 0.051 0.051 ↑ 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.001..0.001 rows=1 loops=51)

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

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

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

33. 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
34. 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)

35. 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
36. 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
37. 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
38. 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)
39. 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)

40. 0.000 0.000 ↓ 0.0 0

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

41. 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 : 7.051 ms
Execution time : 357.168 ms