explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7jPR

Settings
# exclusive inclusive rows x rows loops node
1. 0.026 354.154 ↑ 1.6 51 1

Unique (cost=114,966.14..114,971.94 rows=80 width=1,822) (actual time=354.129..354.154 rows=51 loops=1)

2. 0.115 354.128 ↑ 1.6 51 1

Sort (cost=114,966.14..114,966.34 rows=80 width=1,822) (actual time=354.128..354.128 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.188 354.013 ↑ 1.6 51 1

Nested Loop (cost=18,432.98..114,963.62 rows=80 width=1,822) (actual time=345.640..354.013 rows=51 loops=1)

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

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

Hash Left Join (cost=18,432.69..114,949.31 rows=80 width=1,826) (actual time=345.588..353.812 rows=51 loops=1)

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

Hash Left Join (cost=17,762.20..114,275.82 rows=80 width=1,794) (actual time=345.567..353.778 rows=51 loops=1)

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

Hash Left Join (cost=17,712.37..114,207.93 rows=80 width=1,794) (actual time=345.553..353.754 rows=51 loops=1)

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

Nested Loop Left Join (cost=17,699.22..114,194.47 rows=80 width=1,278) (actual time=345.537..353.726 rows=51 loops=1)

9. 0.020 353.639 ↑ 1.6 51 1

Nested Loop Left Join (cost=17,698.94..114,169.93 rows=80 width=1,251) (actual time=345.528..353.639 rows=51 loops=1)

10. 0.013 353.517 ↑ 1.6 51 1

Nested Loop Left Join (cost=17,698.65..114,136.15 rows=80 width=1,251) (actual time=345.520..353.517 rows=51 loops=1)

11. 0.031 353.402 ↑ 1.6 51 1

Nested Loop Left Join (cost=17,698.36..114,073.94 rows=80 width=1,247) (actual time=345.511..353.402 rows=51 loops=1)

12. 0.037 353.269 ↑ 1.5 51 1

Nested Loop Left Join (cost=17,698.08..114,041.04 rows=74 width=1,247) (actual time=345.498..353.269 rows=51 loops=1)

13. 0.031 353.130 ↑ 1.5 51 1

Nested Loop (cost=17,697.80..114,001.59 rows=74 width=1,222) (actual time=345.488..353.130 rows=51 loops=1)

14. 0.048 352.997 ↑ 1.5 51 1

Nested Loop (cost=17,697.51..113,976.69 rows=74 width=1,212) (actual time=345.479..352.997 rows=51 loops=1)

15. 0.025 352.847 ↑ 1.5 51 1

Nested Loop (cost=17,697.22..113,952.95 rows=74 width=1,201) (actual time=345.468..352.847 rows=51 loops=1)

16. 0.042 352.663 ↑ 14.7 53 1

Nested Loop (cost=17,696.93..113,700.85 rows=778 width=1,185) (actual time=345.452..352.663 rows=53 loops=1)

17. 4.219 350.734 ↑ 1.2 629 1

Hash Join (cost=17,696.50..108,132.17 rows=775 width=28) (actual time=344.730..350.734 rows=629 loops=1)

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

Seq Scan on road_card_day (cost=0.00..90,331.80 rows=10,985 width=12) (actual time=305.076..306.919 rows=12,120 loops=1)

  • Filter: ((road_card_day_date >= '2020-02-01'::date) AND (road_card_day_date <= '2020-03-19'::date))
  • Rows Removed by Filter: 3859219
19. 7.579 39.596 ↑ 1.0 40,900 1

Hash (cost=17,165.51..17,165.51 rows=42,479 width=24) (actual time=39.596..39.596 rows=40,900 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 2397kB
20. 28.920 32.017 ↑ 1.0 40,900 1

Bitmap Heap Scan on road_card (cost=859.87..17,165.51 rows=42,479 width=24) (actual time=4.337..32.017 rows=40,900 loops=1)

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

Bitmap Index Scan on index_firma1_id (cost=0.00..849.25 rows=45,443 width=0) (actual time=3.097..3.097 rows=46,113 loops=1)

  • Index Cond: (firma1_id = 106)
22. 1.887 1.887 ↓ 0.0 0 629

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=629)

  • 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.159 0.159 ↑ 1.0 1 53

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=53)

  • Index Cond: (kierowca_id = road_card_item.kierowca_id)
  • Filter: (wymaga_akcept = 1)
  • Rows Removed by Filter: 0
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.002..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.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
32. 0.001 0.001 ↓ 0.0 0 1

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

33. 0.000 0.000 ↓ 0.0 0 1

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

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

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

35. 0.000 0.009 ↓ 0.0 0 1

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

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

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

  • Group Key: pojazd_zatwierdzanie_jazd_1.pojazd_id
37. 0.007 0.008 ↓ 0.0 0 1

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

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

Hash Left Join (cost=471.72..537.03 rows=1,770 width=23) (actual time=0.001..0.001 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 : 5.833 ms
Execution time : 354.702 ms