explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HtrQi

Settings
# exclusive inclusive rows x rows loops node
1. 0.057 357.876 ↑ 142.9 7 1

Function Scan on generate_series dd (cost=0.01..170,421,139.13 rows=1,000 width=8) (actual time=63.161..357.876 rows=7 loops=1)

2.          

SubPlan (for Function Scan)

3. 0.035 357.819 ↑ 1.0 1 7

Aggregate (cost=170,421.11..170,421.13 rows=1 width=8) (actual time=51.117..51.117 rows=1 loops=7)

4. 0.021 357.784 ↓ 1.5 3 7

Subquery Scan on z (cost=170,421.06..170,421.11 rows=2 width=8) (actual time=51.110..51.112 rows=3 loops=7)

  • Filter: (z.count <> 0)
5. 0.021 357.763 ↑ 1.0 3 7

Limit (cost=170,421.06..170,421.07 rows=3 width=16) (actual time=51.109..51.109 rows=3 loops=7)

6. 10.381 357.742 ↑ 5,271.7 3 7

Sort (cost=170,421.06..170,460.60 rows=15,815 width=16) (actual time=51.106..51.106 rows=3 loops=7)

  • Sort Key: ((COALESCE(t.c, '0'::bigint) + COALESCE((count(*)), '0'::bigint))) DESC
  • Sort Method: top-N heapsort Memory: 25kB
7. 20.993 347.361 ↓ 1.0 15,816 7

Hash Left Join (cost=149,003.65..170,216.66 rows=15,815 width=16) (actual time=30.691..49.623 rows=15,816 loops=7)

  • Hash Cond: (bort.id = t.id_bort)
8. 36.470 184.828 ↓ 1.0 15,816 7

Hash Right Join (cost=14,476.08..35,590.02 rows=15,815 width=12) (actual time=10.303..26.404 rows=15,816 loops=7)

  • Hash Cond: (driver.id = bort.id_driver)
9. 10.689 139.062 ↓ 1.0 15,816 7

Merge Left Join (cost=11,087.24..31,986.57 rows=15,608 width=12) (actual time=8.969..19.866 rows=15,816 loops=7)

  • Merge Cond: (driver.id = driver_1.id)
10. 65.555 65.555 ↓ 1.0 15,816 7

Index Only Scan using driver_id_pk on driver (cost=0.41..20,860.71 rows=15,608 width=4) (actual time=0.004..9.365 rows=15,816 loops=7)

  • Heap Fetches: 74227
11. 0.168 62.818 ↓ 52.0 52 7

Sort (cost=11,086.83..11,086.83 rows=1 width=12) (actual time=8.964..8.974 rows=52 loops=7)

  • Sort Key: driver_1.id
  • Sort Method: quicksort Memory: 27kB
12. 0.000 62.650 ↓ 52.0 52 7

Nested Loop (cost=11,078.76..11,086.82 rows=1 width=12) (actual time=8.757..8.950 rows=52 loops=7)

13. 0.252 61.278 ↓ 52.0 52 7

HashAggregate (cost=11,078.35..11,078.36 rows=1 width=4) (actual time=8.746..8.754 rows=52 loops=7)

  • Group Key: people_buh.id_people
14. 61.026 61.026 ↑ 23.9 53 7

Index Scan using people_buh_idx on people_buh (cost=0.57..11,072.02 rows=1,267 width=4) (actual time=0.154..8.718 rows=53 loops=7)

  • Index Cond: ((data_time > date_trunc('day'::text, dd.dd)) AND (data_time < (date_trunc('day'::text, dd.dd) + '1 day'::interval)))
  • Filter: ((firma_order IS NOT NULL) AND (comment IS NULL))
  • Rows Removed by Filter: 32279
15. 1.444 1.444 ↑ 1.0 1 361

Index Scan using driver_idx5 on driver driver_1 (cost=0.41..8.44 rows=1 width=8) (actual time=0.003..0.004 rows=1 loops=361)

  • Index Cond: (id_people = people_buh.id_people)
16. 3.045 9.296 ↓ 1.0 15,816 1

Hash (cost=3,191.15..3,191.15 rows=15,815 width=12) (actual time=9.296..9.296 rows=15,816 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 808kB
17. 6.251 6.251 ↓ 1.0 15,816 1

Seq Scan on bort (cost=0.00..3,191.15 rows=15,815 width=12) (actual time=0.004..6.251 rows=15,816 loops=1)

18. 1.288 141.540 ↓ 78.5 1,728 7

Hash (cost=134,527.30..134,527.30 rows=22 width=12) (actual time=20.220..20.220 rows=1,728 loops=7)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 95kB
19. 1.043 140.252 ↓ 78.5 1,728 7

Subquery Scan on t (cost=134,526.86..134,527.30 rows=22 width=12) (actual time=19.549..20.036 rows=1,728 loops=7)

20. 25.445 139.209 ↓ 78.5 1,728 7

HashAggregate (cost=134,526.86..134,527.08 rows=22 width=4) (actual time=19.544..19.887 rows=1,728 loops=7)

  • Group Key: orders.id_bort
21. 113.764 113.764 ↑ 6.2 12,242 7

Index Scan using orders_idx3 on orders (cost=0.57..134,144.56 rows=76,459 width=4) (actual time=0.011..16.252 rows=12,242 loops=7)

  • Index Cond: ((date_create > date_trunc('day'::text, dd.dd)) AND (date_create < (date_trunc('day'::text, dd.dd) + '1 day'::interval)))
  • Filter: ((event_end)::text = 'ok'::text)
  • Rows Removed by Filter: 7734
Planning time : 2.106 ms