explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OLNM

Settings
# exclusive inclusive rows x rows loops node
1. 50.616 2,929.907 ↓ 24.6 173,046 1

Unique (cost=225,711.10..225,957.08 rows=7,028 width=67) (actual time=2,786.455..2,929.907 rows=173,046 loops=1)

2. 353.190 2,879.291 ↓ 24.6 173,046 1

Sort (cost=225,711.10..225,728.67 rows=7,028 width=67) (actual time=2,786.451..2,879.291 rows=173,046 loops=1)

  • Sort Key: kierowca.kierowca_id, driver_events_filter.datetime_from, driver_events_filter.country, country.name, driver_events_filter.datetime_to, kierowca.nazwisko, kierowca.imie, (sum(date_part('epoch'::text, (driver_events_filter.datetime_to - driver_events_filter.datetime_from)))), driver_events_filter.status_id, driver_events_filter.driver, (date_part('epoch'::text, driver_events_filter.datetime_from))
  • Sort Method: external merge Disk: 20944kB
3. 375.340 2,526.101 ↓ 24.6 173,046 1

HashAggregate (cost=225,174.20..225,262.05 rows=7,028 width=67) (actual time=2,401.198..2,526.101 rows=173,046 loops=1)

  • Group Key: kierowca.kierowca_id, driver_events_filter.datetime_from, driver_events_filter.status_id, driver_events_filter.driver, kierowca.imie, kierowca.nazwisko, driver_events_filter.country, country.name, driver_events_filter.datetime_to
4. 123.624 2,150.761 ↓ 24.6 173,046 1

Nested Loop Left Join (cost=810.20..224,963.36 rows=7,028 width=67) (actual time=10.359..2,150.761 rows=173,046 loops=1)

5. 271.179 1,681.045 ↓ 24.6 173,046 1

Hash Join (cost=810.06..223,731.88 rows=7,028 width=56) (actual time=10.342..1,681.045 rows=173,046 loops=1)

  • Hash Cond: ((driver_events_filter.driver)::text = (kierowca_kod.kod_identyfikatora14)::text)
6. 1,399.677 1,399.677 ↓ 13.0 1,389,194 1

Index Scan using driver_events_filter_index02 on driver_events_filter (cost=0.57..216,459.84 rows=106,537 width=36) (actual time=0.062..1,399.677 rows=1,389,194 loops=1)

  • Index Cond: ((datetime_from >= '2019-11-01 00:00:00+01'::timestamp with time zone) AND (datetime_from < '2019-11-28 00:00:00+01'::timestamp with time zone))
  • Filter: (status_id = ANY ('{0,1,2,3}'::integer[]))
  • Rows Removed by Filter: 1092
7. 0.181 10.189 ↓ 1.4 662 1

Hash (cost=803.70..803.70 rows=463 width=34) (actual time=10.189..10.189 rows=662 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 46kB
8. 1.082 10.008 ↓ 1.4 663 1

Hash Join (cost=528.27..803.70 rows=463 width=34) (actual time=7.010..10.008 rows=663 loops=1)

  • Hash Cond: (kierowca_kod.kierowca_id = kierowca.kierowca_id)
9. 4.857 7.614 ↓ 1.0 11,479 1

HashAggregate (cost=289.74..403.75 rows=11,402 width=22) (actual time=5.673..7.614 rows=11,479 loops=1)

  • Group Key: kierowca_kod.kierowca_id, kierowca_kod.kod_identyfikatora14
10. 2.757 2.757 ↓ 1.0 11,479 1

Seq Scan on kierowca_kod (cost=0.00..232.49 rows=11,449 width=22) (actual time=0.014..2.757 rows=11,479 loops=1)

11. 0.160 1.312 ↓ 1.0 681 1

Hash (cost=230.43..230.43 rows=649 width=20) (actual time=1.312..1.312 rows=681 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 36kB
12. 1.019 1.152 ↓ 1.0 681 1

Bitmap Heap Scan on kierowca (cost=13.31..230.43 rows=649 width=20) (actual time=0.168..1.152 rows=681 loops=1)

  • Recheck Cond: (firma1_id = 346)
  • Heap Blocks: exact=99
13. 0.133 0.133 ↓ 1.0 681 1

Bitmap Index Scan on kierowca_firma1_id (cost=0.00..13.15 rows=649 width=0) (actual time=0.133..0.133 rows=681 loops=1)

  • Index Cond: (firma1_id = 346)
14. 346.092 346.092 ↑ 1.0 1 173,046

Index Scan using country_code3_x on country (cost=0.15..0.17 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=173,046)

  • Index Cond: ((code3)::text = (driver_events_filter.country)::text)
Planning time : 2.516 ms
Execution time : 2,941.895 ms