explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YCJq

Settings
# exclusive inclusive rows x rows loops node
1. 329.214 4,896.979 ↓ 1.6 64,654 1

Hash Left Join (cost=128,660.43..155,890.08 rows=40,186 width=181) (actual time=3,921.670..4,896.979 rows=64,654 loops=1)

  • Hash Cond: (source.estilo = jerarquia.estilo)
2. 281.373 3,245.110 ↓ 1.6 64,654 1

Hash Right Join (cost=89,215.83..107,709.13 rows=40,186 width=125) (actual time=2,598.429..3,245.110 rows=64,654 loops=1)

  • Hash Cond: (stock.sku = source.sku)
3. 365.405 365.405 ↑ 1.0 550,360 1

Seq Scan on stock (cost=0.00..10,926.60 rows=550,360 width=13) (actual time=0.013..365.405 rows=550,360 loops=1)

4. 26.944 2,598.332 ↓ 1.6 64,654 1

Hash (cost=87,967.50..87,967.50 rows=40,186 width=121) (actual time=2,598.331..2,598.332 rows=64,654 loops=1)

  • Buckets: 32,768 Batches: 2 Memory Usage: 2,879kB
5. 30.802 2,571.388 ↓ 1.6 64,654 1

Subquery Scan on source (cost=87,465.18..87,967.50 rows=40,186 width=121) (actual time=2,517.363..2,571.388 rows=64,654 loops=1)

6. 196.086 2,540.586 ↓ 1.6 64,654 1

Sort (cost=87,465.18..87,565.64 rows=40,186 width=153) (actual time=2,517.361..2,540.586 rows=64,654 loops=1)

  • Sort Key: (sum(ventas.monto)) DESC, ventas.sku
  • Sort Method: external merge Disk: 3,608kB
7. 171.292 2,344.500 ↓ 1.6 64,654 1

Finalize GroupAggregate (cost=67,373.08..81,231.57 rows=40,186 width=153) (actual time=1,776.739..2,344.500 rows=64,654 loops=1)

  • Group Key: ventas.sku
8. 272.418 2,173.208 ↓ 1.3 107,410 1

Gather Merge (cost=67,373.08..79,523.67 rows=80,372 width=121) (actual time=1,776.708..2,173.208 rows=107,410 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
9. 87.013 1,900.790 ↑ 1.1 35,803 3 / 3

Partial GroupAggregate (cost=66,373.05..69,246.72 rows=40,186 width=121) (actual time=1,757.905..1,900.790 rows=35,803 loops=3)

  • Group Key: ventas.sku
10. 1,421.914 1,813.777 ↑ 1.1 103,062 3 / 3

Sort (cost=66,373.05..66,647.70 rows=109,858 width=27) (actual time=1,757.893..1,813.777 rows=103,062 loops=3)

  • Sort Key: ventas.sku
  • Sort Method: external merge Disk: 4,264kB
11. 166.735 391.863 ↑ 1.1 103,062 3 / 3

Hash Semi Join (cost=9,992.60..54,546.54 rows=109,858 width=27) (actual time=68.244..391.863 rows=103,062 loops=3)

  • Hash Cond: (ventas.id_depto = neg_div_depto.id_depto)
12. 199.135 225.072 ↑ 1.1 104,436 3 / 3

Parallel Bitmap Heap Scan on ventas (cost=9,990.11..53,033.51 rows=109,858 width=27) (actual time=68.166..225.072 rows=104,436 loops=3)

  • Recheck Cond: ((fecha >= (concat('2019-05-26 23:30:00', '-04'))::timestamp with time zone) AND (fecha <= (concat('2019-05-29 23:59:59', '-04'))::timestamp with time zone))
  • Filter: (estado ~~ 'paid'::text)
  • Heap Blocks: exact=1,656
13. 25.937 25.937 ↓ 1.2 313,307 1 / 3

Bitmap Index Scan on ventas_estado_fecha_sku_idx (cost=0.00..9,924.19 rows=263,660 width=0) (actual time=77.812..77.812 rows=313,307 loops=1)

  • Index Cond: ((estado = 'paid'::text) AND (fecha >= (concat('2019-05-26 23:30:00', '-04'))::timestamp with time zone) AND (fecha <= (concat('2019-05-29 23:59:59', '-04'))::timestamp with time zone))
14. 0.024 0.056 ↑ 1.0 66 3 / 3

Hash (cost=1.66..1.66 rows=66 width=3) (actual time=0.056..0.056 rows=66 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
15. 0.032 0.032 ↑ 1.0 66 3 / 3

Seq Scan on neg_div_depto (cost=0.00..1.66 rows=66 width=3) (actual time=0.015..0.032 rows=66 loops=3)

  • Filter: (id_depto IS NOT NULL)
16. 351.335 1,322.655 ↓ 1.0 786,409 1

Hash (cost=23,613.60..23,613.60 rows=779,360 width=35) (actual time=1,322.651..1,322.655 rows=786,409 loops=1)

  • Buckets: 65,536 Batches: 16 Memory Usage: 3,841kB
17. 971.320 971.320 ↓ 1.0 786,409 1

Seq Scan on jerarquia (cost=0.00..23,613.60 rows=779,360 width=35) (actual time=1.281..971.320 rows=786,409 loops=1)