explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nDwn

Settings
# exclusive inclusive rows x rows loops node
1. 148.998 3,215.601 ↓ 2.8 565,110 1

Unique (cost=117,124.51..120,105.43 rows=198,728 width=57) (actual time=2,955.911..3,215.601 rows=565,110 loops=1)

2. 1,413.945 3,066.603 ↓ 3.5 696,472 1

Sort (cost=117,124.51..117,621.33 rows=198,728 width=57) (actual time=2,955.910..3,066.603 rows=696,472 loops=1)

  • Sort Key: pojazd_miejsca_aktywnosc.data_wjazdu, pojazd_miejsca_aktywnosc.data_wyjazdu, miejsca.nazwa, marka.nazwa, pojazd.model
  • Sort Method: external merge Disk: 41072kB
3. 199.306 1,652.658 ↓ 3.5 696,472 1

Hash Join (cost=25,795.72..92,163.51 rows=198,728 width=57) (actual time=470.629..1,652.658 rows=696,472 loops=1)

  • Hash Cond: (pojazd_miejsca_aktywnosc.pojazd_id = pojazd.pojazd_id)
4. 242.228 1,449.583 ↓ 3.5 696,472 1

Hash Join (cost=25,128.17..88,763.45 rows=198,728 width=46) (actual time=466.847..1,449.583 rows=696,472 loops=1)

  • Hash Cond: (pojazd_miejsca_aktywnosc.miejsca_id = miejsca.miejsca_id)
5. 751.983 1,200.898 ↓ 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=460.364..1,200.898 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
6. 448.915 448.915 ↓ 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=448.915..448.915 rows=3,494,865 loops=1)

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 136kB
8. 1.396 5.177 ↓ 2.0 2,185 1

Hash Right Join (cost=349.54..412.87 rows=1,096 width=30) (actual time=4.304..5.177 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))
9. 0.031 0.031 ↑ 970.0 2 1

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

10. 1.371 2.834 ↓ 1.0 2,185 1

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

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

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

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

SubPlan (forHash Right Join)

13. 0.721 0.916 ↑ 1.0 706 1

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

  • Recheck Cond: (auser_id = 1)
  • Heap Blocks: exact=126
14. 0.195 0.195 ↑ 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.195..0.195 rows=706 loops=1)

  • Index Cond: (auser_id = 1)
15. 0.861 3.769 ↑ 1.0 1,523 1

Hash (cost=648.51..648.51 rows=1,523 width=19) (actual time=3.769..3.769 rows=1,523 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 84kB
16. 1.099 2.908 ↑ 1.0 1,523 1

Hash Left Join (cost=3.34..648.51 rows=1,523 width=19) (actual time=0.122..2.908 rows=1,523 loops=1)

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

Seq Scan on pojazd (cost=0.00..624.23 rows=1,523 width=16) (actual time=0.008..1.707 rows=1,523 loops=1)

18. 0.057 0.102 ↓ 1.0 108 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 5kB
19. 0.045 0.045 ↓ 1.0 108 1

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

Planning time : 1.906 ms
Execution time : 3,239.791 ms