explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ztfK : Optimization for: Optimization for: Optimization for: plan #3hmn; plan #4i4; plan #R30

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 5.197 27.359 ↑ 51.0 319 1

HashAggregate (cost=1,215.13..1,540.51 rows=16,269 width=48) (actual time=27.197..27.359 rows=319 loops=1)

  • Group Key: (((s.annee)::text || ' - '::text) || a.libelle)
2.          

Initplan (forHashAggregate)

3. 0.002 0.002 ↑ 1.0 1 1

Result (cost=0.00..0.02 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

4. 6.525 22.160 ↑ 1.0 16,870 1

Hash Left Join (cost=181.07..1,004.18 rows=16,874 width=40) (actual time=1.950..22.160 rows=16,870 loops=1)

  • Hash Cond: (v.appellation_id = a.id)
5. 4.921 15.521 ↑ 1.0 16,870 1

Hash Join (cost=170.89..780.38 rows=16,874 width=16) (actual time=1.830..15.521 rows=16,870 loops=1)

  • Hash Cond: (s.vin_id = v.id)
6. 4.552 8.853 ↑ 1.0 16,870 1

Hash Join (cost=1.49..566.66 rows=16,874 width=16) (actual time=0.076..8.853 rows=16,870 loops=1)

  • Hash Cond: (s.contenant_id = c.id)
7. 4.293 4.293 ↑ 1.0 16,870 1

Index Scan using stock_annee_idx on stock s (cost=0.42..458.72 rows=16,874 width=16) (actual time=0.061..4.293 rows=16,870 loops=1)

  • Index Cond: (annee = $0)
8. 0.002 0.008 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=8) (actual time=0.008..0.008 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
9. 0.006 0.006 ↑ 1.0 3 1

Seq Scan on contenant c (cost=0.00..1.03 rows=3 width=8) (actual time=0.005..0.006 rows=3 loops=1)

10. 0.909 1.747 ↑ 1.0 6,062 1

Hash (cost=93.62..93.62 rows=6,062 width=8) (actual time=1.747..1.747 rows=6,062 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 301kB
11. 0.838 0.838 ↑ 1.0 6,062 1

Seq Scan on vin v (cost=0.00..93.62 rows=6,062 width=8) (actual time=0.006..0.838 rows=6,062 loops=1)

12. 0.064 0.114 ↑ 1.0 319 1

Hash (cost=6.19..6.19 rows=319 width=20) (actual time=0.114..0.114 rows=319 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
13. 0.050 0.050 ↑ 1.0 319 1

Seq Scan on appellation a (cost=0.00..6.19 rows=319 width=20) (actual time=0.006..0.050 rows=319 loops=1)