explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8oc4

Settings
# exclusive inclusive rows x rows loops node
1. 276.021 6,075.467 ↓ 2.8 565,137 1

Unique (cost=135,808.69..140,776.89 rows=198,728 width=90) (actual time=5,638.528..6,075.467 rows=565,137 loops=1)

2. 2,369.122 5,799.446 ↓ 3.5 696,472 1

Sort (cost=135,808.69..136,305.51 rows=198,728 width=90) (actual time=5,638.526..5,799.446 rows=696,472 loops=1)

  • Sort Key: pojazd_miejsca_aktywnosc.data_wjazdu, pojazd_miejsca_aktywnosc.data_wyjazdu, (date_part('epoch'::text, (pojazd_miejsca_aktywnosc.data_wyjazdu - pojazd_miejsca_aktywnosc.data_wjazdu))), miejsca.nazwa, ((((COALESCE(kierowca.imie, ''::character varying))::text || ' '::text) || (COALESCE(kierowca.nazwisko, ''::character varying))::text)), (btrim(((CASE WHEN (pojazd.pokazuj_nr_rejestracyjny = 1) THEN pojazd.nr_rejestracyjny ELSE ''::character varying END)::text || CASE WHEN (pojazd.pokazuj_nr_boczny = 1) THEN ((' ('::text || (pojazd.nr_boczny_pojazdu)::text) || ')'::text) ELSE ''::text END))), marka.nazwa, pojazd.model, (((((date_trunc('week'::text, pojazd_miejsca_aktywnosc.data_wjazdu))::date)::text || ' - '::text) || (((((date_trunc('week'::text, pojazd_miejsca_aktywnosc.data_wjazdu))::date + '7 days'::interval) - '1 day'::interval))::date)::text))
  • Sort Method: external merge Disk: 79808kB
3. 1,819.404 3,430.324 ↓ 3.5 696,472 1

Hash Left Join (cost=26,111.38..108,128.19 rows=198,728 width=90) (actual time=484.821..3,430.324 rows=696,472 loops=1)

  • Hash Cond: (pojazd_miejsca_aktywnosc.kierowca_id = kierowca.kierowca_id)
4. 239.656 1,606.565 ↓ 3.5 696,472 1

Hash Join (cost=25,795.72..92,163.51 rows=198,728 width=79) (actual time=480.408..1,606.565 rows=696,472 loops=1)

  • Hash Cond: (pojazd_miejsca_aktywnosc.pojazd_id = pojazd.pojazd_id)
5. 264.681 1,359.306 ↓ 3.5 696,472 1

Hash Join (cost=25,128.17..88,763.45 rows=198,728 width=50) (actual time=472.792..1,359.306 rows=696,472 loops=1)

  • Hash Cond: (pojazd_miejsca_aktywnosc.miejsca_id = miejsca.miejsca_id)
6. 633.575 1,087.747 ↓ 1.8 696,472 1

Bitmap Heap Scan on pojazd_miejsca_aktywnosc (cost=24,701.60..84,866.04 rows=395,840 width=28) (actual time=465.893..1,087.747 rows=696,472 loops=1)

  • Recheck Cond: (data_wjazdu <= '2019-08-08 23:59:59'::timestamp without time zone)
  • Filter: ((data_wyjazdu >= '2019-08-01 00:00:00'::timestamp without time zone) OR (data_wyjazdu IS NULL))
  • Rows Removed by Filter: 2797037
  • Heap Blocks: exact=42528
7. 454.172 454.172 ↓ 3.0 3,494,865 1

Bitmap Index Scan on pojazd_miejsca_aktywnosc_data_wjazdu (cost=0.00..24,602.65 rows=1,175,762 width=0) (actual time=454.172..454.172 rows=3,494,865 loops=1)

  • Index Cond: (data_wjazdu <= '2019-08-08 23:59:59'::timestamp without time zone)
8. 1.014 6.878 ↓ 2.0 2,185 1

Hash (cost=412.87..412.87 rows=1,096 width=30) (actual time=6.878..6.878 rows=2,185 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 136kB
9. 1.300 5.864 ↓ 2.0 2,185 1

Hash Right Join (cost=349.54..412.87 rows=1,096 width=30) (actual time=5.020..5.864 rows=2,185 loops=1)

  • Hash Cond: (miejsca_grupa_pojazdow.miejsca_id = miejsca.miejsca_id)
  • Filter: ((miejsca_grupa_pojazdow.grupa_pojazdow_id IS NULL) OR (hashed SubPlan 1))
10. 0.011 0.011 ↑ 970.0 2 1

Seq Scan on miejsca_grupa_pojazdow (cost=0.00..29.40 rows=1,940 width=8) (actual time=0.010..0.011 rows=2 loops=1)

11. 1.119 2.871 ↓ 1.0 2,185 1

Hash (cost=79.30..79.30 rows=2,182 width=30) (actual time=2.871..2.871 rows=2,185 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 136kB
12. 1.752 1.752 ↓ 1.0 2,185 1

Seq Scan on miejsca (cost=0.00..79.30 rows=2,182 width=30) (actual time=0.022..1.752 rows=2,185 loops=1)

  • Filter: (firma1_id = 4)
  • Rows Removed by Filter: 2
13.          

SubPlan (forHash Right Join)

14. 1.479 1.682 ↑ 1.0 706 1

Bitmap Heap Scan on auser_grupa_pojazdow (cost=17.97..241.13 rows=733 width=4) (actual time=0.262..1.682 rows=706 loops=1)

  • Recheck Cond: (auser_id = 1)
  • Heap Blocks: exact=126
15. 0.203 0.203 ↑ 1.0 706 1

Bitmap Index Scan on auser_grupa_pojazdow_user_id_x (cost=0.00..17.79 rows=733 width=0) (actual time=0.203..0.203 rows=706 loops=1)

  • Index Cond: (auser_id = 1)
16. 1.169 7.603 ↑ 1.0 1,523 1

Hash (cost=648.51..648.51 rows=1,523 width=37) (actual time=7.603..7.603 rows=1,523 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 103kB
17. 1.295 6.434 ↑ 1.0 1,523 1

Hash Left Join (cost=3.34..648.51 rows=1,523 width=37) (actual time=0.133..6.434 rows=1,523 loops=1)

  • Hash Cond: (pojazd.marka_id = marka.marka_id)
18. 5.039 5.039 ↑ 1.0 1,523 1

Seq Scan on pojazd (cost=0.00..624.23 rows=1,523 width=34) (actual time=0.019..5.039 rows=1,523 loops=1)

19. 0.048 0.100 ↓ 1.0 108 1

Hash (cost=2.04..2.04 rows=104 width=11) (actual time=0.100..0.100 rows=108 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 5kB
20. 0.052 0.052 ↓ 1.0 108 1

Seq Scan on marka (cost=0.00..2.04 rows=104 width=11) (actual time=0.008..0.052 rows=108 loops=1)

21. 1.807 4.355 ↑ 1.0 7,317 1

Hash (cost=223.85..223.85 rows=7,345 width=19) (actual time=4.355..4.355 rows=7,317 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 389kB
22. 2.548 2.548 ↑ 1.0 7,317 1

Seq Scan on kierowca (cost=0.00..223.85 rows=7,345 width=19) (actual time=0.012..2.548 rows=7,317 loops=1)

  • Filter: (firma1_id = 4)
  • Rows Removed by Filter: 3
Planning time : 3.024 ms
Execution time : 6,114.471 ms