explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sm6h

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 1.059 ↓ 0.0 0 1

Unique (cost=358.07..358.15 rows=1 width=301) (actual time=1.059..1.059 rows=0 loops=1)

2. 0.060 1.059 ↓ 0.0 0 1

Sort (cost=358.07..358.08 rows=1 width=301) (actual time=1.059..1.059 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 DESC, (to_char((road_card_item.veh_work_from)::interval, 'HH24:MI:SS'::text)) DESC, 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'::integer 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'::integer WHEN ((road_card_item.verified_driver = 0) AND (road_card_item.verified_driver_comment IS NOT NULL)) THEN '-1'::integer 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: 25kB
3. 0.000 0.999 ↓ 0.0 0 1

Nested Loop Semi Join (cost=131.61..358.06 rows=1 width=301) (actual time=0.999..0.999 rows=0 loops=1)

4. 0.000 0.999 ↓ 0.0 0 1

Nested Loop Left Join (cost=131.19..355.35 rows=1 width=792) (actual time=0.999..0.999 rows=0 loops=1)

  • Join Filter: (pojazd_zatwierdzanie_jazd_1.pojazd_id = pojazd_zatwierdzanie_jazd.pojazd_id)
5. 0.001 0.999 ↓ 0.0 0 1

Nested Loop Left Join (cost=7.83..227.56 rows=1 width=760) (actual time=0.998..0.999 rows=0 loops=1)

  • Join Filter: (pojazd_zatwierdzanie_jazd.pojazd_id = pojazd.pojazd_id)
6. 0.000 0.998 ↓ 0.0 0 1

Nested Loop Left Join (cost=7.83..224.65 rows=1 width=760) (actual time=0.998..0.998 rows=0 loops=1)

7. 0.000 0.998 ↓ 0.0 0 1

Nested Loop Left Join (cost=7.55..224.36 rows=1 width=730) (actual time=0.998..0.998 rows=0 loops=1)

8. 0.000 0.998 ↓ 0.0 0 1

Nested Loop Left Join (cost=7.41..224.20 rows=1 width=714) (actual time=0.998..0.998 rows=0 loops=1)

9. 0.001 0.998 ↓ 0.0 0 1

Nested Loop Left Join (cost=7.13..223.88 rows=1 width=714) (actual time=0.998..0.998 rows=0 loops=1)

10. 0.000 0.997 ↓ 0.0 0 1

Nested Loop Left Join (cost=6.84..223.52 rows=1 width=710) (actual time=0.997..0.997 rows=0 loops=1)

11. 0.000 0.997 ↓ 0.0 0 1

Nested Loop (cost=6.56..222.90 rows=1 width=684) (actual time=0.997..0.997 rows=0 loops=1)

12. 0.001 0.997 ↓ 0.0 0 1

Nested Loop (cost=6.28..222.60 rows=1 width=672) (actual time=0.997..0.997 rows=0 loops=1)

13. 0.000 0.996 ↓ 0.0 0 1

Nested Loop (cost=6.00..221.99 rows=2 width=656) (actual time=0.996..0.996 rows=0 loops=1)

14. 0.000 0.996 ↓ 0.0 0 1

Nested Loop (cost=5.57..218.88 rows=1 width=40) (actual time=0.996..0.996 rows=0 loops=1)

15. 0.024 0.996 ↓ 0.0 0 1

Hash Right Join (cost=5.15..216.23 rows=1 width=36) (actual time=0.996..0.996 rows=0 loops=1)

  • Hash Cond: (pojazd_organizacja.pojazd_id = pojazd.pojazd_id)
16. 0.000 0.000 ↓ 0.0 0

Seq Scan on pojazd_organizacja (cost=0.00..181.32 rows=7,932 width=8) (never executed)

17. 0.001 0.972 ↓ 0.0 0 1

Hash (cost=5.14..5.14 rows=1 width=36) (actual time=0.972..0.972 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
18. 0.000 0.971 ↓ 0.0 0 1

Nested Loop (cost=0.70..5.14 rows=1 width=36) (actual time=0.971..0.971 rows=0 loops=1)

19. 0.971 0.971 ↓ 0.0 0 1

Index Scan using index_firma1_id on road_card (cost=0.29..2.51 rows=1 width=25) (actual time=0.970..0.971 rows=0 loops=1)

  • Index Cond: (firma1_id = 106)
  • Filter: (gps_load = 1)
20. 0.000 0.000 ↓ 0.0 0

Index Scan using pojazd_pkey on pojazd (cost=0.41..2.63 rows=1 width=15) (never executed)

  • Index Cond: (pojazd_id = road_card.pojazd_id)
21. 0.000 0.000 ↓ 0.0 0

Index Scan using epro_road_card_day_unique on road_card_day (cost=0.42..2.64 rows=1 width=12) (never executed)

  • Index Cond: ((road_card_id = road_card.road_card_id) AND (road_card_day_date >= '2020-02-01'::date) AND (road_card_day_date <= '2020-03-19'::date))
22. 0.000 0.000 ↓ 0.0 0

Index Scan using rci_road_card_dat_id_index on road_card_item (cost=0.42..3.07 rows=5 width=624) (never executed)

  • 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)))
23. 0.000 0.000 ↓ 0.0 0

Index Scan using kierowca_organizacja_kierowca_id on kierowca_organizacja (cost=0.28..0.30 rows=1 width=16) (never executed)

  • Index Cond: (kierowca_id = road_card_item.kierowca_id)
  • Filter: (wymaga_akcept = 1)
24. 0.000 0.000 ↓ 0.0 0

Index Scan using kierowca_pkey on kierowca (cost=0.29..0.30 rows=1 width=24) (never executed)

  • Index Cond: (kierowca_id = road_card_item.kierowca_id)
25. 0.000 0.000 ↓ 0.0 0

Index Scan using auser_pkey on auser (cost=0.28..0.62 rows=1 width=26) (never executed)

  • Index Cond: (auser_id = kierowca_organizacja.superior_id)
26. 0.000 0.000 ↓ 0.0 0

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

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

Index Scan using kierowca_organizacja_kierowca_id on kierowca_organizacja superior_details (cost=0.28..0.31 rows=1 width=12) (never executed)

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

Index Scan using firma_struktura_pkey on firma_struktura superior_structure (cost=0.14..0.16 rows=1 width=20) (never executed)

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

Index Scan using firma_cel_wyjazdu_pkey on firma_cel_wyjazdu (cost=0.27..0.29 rows=1 width=34) (never executed)

  • Index Cond: (firma_cel_wyjazdu_id = road_card_item.work_destination_id)
30. 0.000 0.000 ↓ 0.0 0

Seq Scan on pojazd_zatwierdzanie_jazd (cost=0.00..1.85 rows=85 width=4) (never executed)

31. 0.000 0.000 ↓ 0.0 0

GroupAggregate (cost=123.36..125.90 rows=84 width=36) (never executed)

  • Group Key: pojazd_zatwierdzanie_jazd_1.pojazd_id
32. 0.000 0.000 ↓ 0.0 0

Sort (cost=123.36..123.57 rows=85 width=24) (never executed)

  • Sort Key: pojazd_zatwierdzanie_jazd_1.pojazd_id
33. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.28..120.64 rows=85 width=24) (never executed)

34. 0.000 0.000 ↓ 0.0 0

Seq Scan on pojazd_zatwierdzanie_jazd pojazd_zatwierdzanie_jazd_1 (cost=0.00..1.85 rows=85 width=12) (never executed)

35. 0.000 0.000 ↓ 0.0 0

Index Scan using auser_pkey on auser auser_1 (cost=0.28..1.40 rows=1 width=20) (never executed)

  • Index Cond: (auser_id = pojazd_zatwierdzanie_jazd_1.auser_id)
36. 0.000 0.000 ↓ 0.0 0

Index Only Scan using auser_firma_index01 on auser_firma (cost=0.42..2.64 rows=1 width=4) (never executed)

  • Index Cond: ((auser_id = 15055) AND (firma1_id = 106))
  • Heap Fetches: 0
Planning time : 42.440 ms
Execution time : 2.481 ms