explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HqGc

Settings
# exclusive inclusive rows x rows loops node
1. 0.062 356.313 ↑ 142.9 7 1

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

2.          

SubPlan (for Function Scan)

3. 0.035 356.251 ↑ 1.0 1 7

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

4. 0.014 356.216 ↓ 1.5 3 7

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

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

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

6. 10.458 356.188 ↑ 5,271.7 3 7

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

  • Sort Key: ((COALESCE(t.c, '0'::bigint) + COALESCE((count(*)), '0'::bigint))) DESC
  • Sort Method: top-N heapsort Memory: 25kB
7. 21.007 345.730 ↑ 1.0 15,815 7

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

  • Hash Cond: (bort.id = t.id_bort)
8. 35.485 180.313 ↑ 1.0 15,815 7

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

  • Hash Cond: (driver.id = bort.id_driver)
9. 10.766 135.429 ↓ 1.0 15,815 7

Merge Left Join (cost=11,087.24..31,986.57 rows=15,608 width=12) (actual time=8.857..19.347 rows=15,815 loops=7)

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

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

  • Heap Fetches: 63827
11. 0.168 62.006 ↓ 52.0 52 7

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

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

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

13. 0.259 60.375 ↓ 52.0 52 7

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

  • Group Key: people_buh.id_people
14. 60.116 60.116 ↑ 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.153..8.588 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.086 9.399 ↑ 1.0 15,815 1

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

  • Buckets: 16384 Batches: 1 Memory Usage: 808kB
17. 6.313 6.313 ↑ 1.0 15,815 1

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

18. 1.386 144.410 ↓ 78.5 1,728 7

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

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

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

20. 25.585 142.023 ↓ 78.5 1,728 7

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

  • Group Key: orders.id_bort
21. 116.438 116.438 ↑ 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.634 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 : 3.310 ms