explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Twhz : Optimization for: Optimization for: Optimization for: plan #k3S6; plan #oEp; plan #M9nK

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 5.018 351.727 ↓ 2.5 10,610 1

GroupAggregate (cost=57,204.03..57,354.56 rows=4,301 width=48) (actual time=345.789..351.727 rows=10,610 loops=1)

  • Group Key: ((((s.annee)::text || ' - '::text) || a.libelle))
2. 54.056 346.709 ↓ 4.0 17,149 1

Sort (cost=57,204.03..57,214.78 rows=4,301 width=40) (actual time=345.779..346.709 rows=17,149 loops=1)

  • Sort Key: ((((s.annee)::text || ' - '::text) || a.libelle))
  • Sort Method: quicksort Memory: 2134kB
3. 6.988 292.653 ↓ 4.0 17,149 1

Hash Left Join (cost=450.02..56,944.45 rows=4,301 width=40) (actual time=4.758..292.653 rows=17,149 loops=1)

  • Hash Cond: (v.appellation_id = a.id)
4. 6.393 285.539 ↓ 4.0 17,149 1

Hash Join (cost=421.10..56,861.09 rows=4,301 width=16) (actual time=4.625..285.539 rows=17,149 loops=1)

  • Hash Cond: (s.vin_id = v.id)
5. 2.973 274.774 ↓ 4.0 17,149 1

Merge Join (cost=0.58..56,429.26 rows=4,301 width=16) (actual time=0.230..274.774 rows=17,149 loops=1)

  • Merge Cond: (c.id = s.contenant_id)
6. 0.023 0.023 ↑ 400.0 3 1

Index Scan using contenant_pkey on contenant c (cost=0.15..66.15 rows=1,200 width=8) (actual time=0.020..0.023 rows=3 loops=1)

7. 271.778 271.778 ↓ 4.0 17,149 1

Index Scan using mixte on stock s (cost=0.42..56,306.35 rows=4,301 width=16) (actual time=0.138..271.778 rows=17,149 loops=1)

  • Filter: ((annee)::double precision = (round((random() * '50'::double precision)) + '1950'::double precision))
  • Rows Removed by Filter: 842980
8. 1.782 4.372 ↑ 1.1 6,058 1

Hash (cost=334.96..334.96 rows=6,845 width=8) (actual time=4.372..4.372 rows=6,058 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 301kB
9. 2.590 2.590 ↑ 1.1 6,058 1

Index Scan using vin_pkey on vin v (cost=0.28..334.96 rows=6,845 width=8) (actual time=0.027..2.590 rows=6,058 loops=1)

10. 0.055 0.126 ↑ 1.0 319 1

Hash (cost=24.93..24.93 rows=319 width=36) (actual time=0.126..0.126 rows=319 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
11. 0.071 0.071 ↑ 1.0 319 1

Index Scan using appellation_pkey on appellation a (cost=0.15..24.93 rows=319 width=36) (actual time=0.006..0.071 rows=319 loops=1)