explain.depesz.com

PostgreSQL's explain analyze made readable

Result: entZ

Settings
# exclusive inclusive rows x rows loops node
1. 127.936 7,779.646 ↓ 1.6 64,654 1

Subquery Scan on source (cost=163,193.74..164,298.85 rows=40,186 width=157) (actual time=7,618.696..7,779.646 rows=64,654 loops=1)

2. 236.188 7,651.710 ↓ 1.6 64,654 1

Sort (cost=163,193.74..163,294.20 rows=40,186 width=161) (actual time=7,618.682..7,651.710 rows=64,654 loops=1)

  • Sort Key: (sum(ventas.monto)) DESC, ventas.sku, (sum(ventas.cantidad))
  • Sort Method: external merge Disk: 5,800kB
3. 223.255 7,415.522 ↓ 1.6 64,654 1

Finalize GroupAggregate (cost=142,014.21..156,823.63 rows=40,186 width=161) (actual time=6,695.214..7,415.522 rows=64,654 loops=1)

  • Group Key: ventas.sku
4. 320.315 7,192.267 ↓ 1.3 107,308 1

Gather Merge (cost=142,014.21..154,713.87 rows=80,372 width=129) (actual time=6,690.502..7,192.267 rows=107,308 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 114.937 6,871.952 ↑ 1.1 35,769 3 / 3

Partial GroupAggregate (cost=141,014.18..144,436.92 rows=40,186 width=129) (actual time=6,657.316..6,871.952 rows=35,769 loops=3)

  • Group Key: ventas.sku
6. 1,134.139 6,757.015 ↑ 1.1 103,062 3 / 3

Sort (cost=141,014.18..141,288.81 rows=109,850 width=52) (actual time=6,644.071..6,757.015 rows=103,062 loops=3)

  • Sort Key: ventas.sku
  • Sort Method: external merge Disk: 6,816kB
7. 139.576 5,622.876 ↑ 1.1 103,062 3 / 3

Hash Semi Join (cost=69,931.04..128,061.40 rows=109,850 width=52) (actual time=3,897.375..5,622.876 rows=103,062 loops=3)

  • Hash Cond: (ventas.id_depto = neg_div_depto.id_depto)
8. 620.329 5,483.241 ↑ 1.1 104,436 3 / 3

Hash Left Join (cost=69,928.55..126,548.47 rows=109,850 width=52) (actual time=3,897.286..5,483.241 rows=104,436 loops=3)

  • Hash Cond: (ventas.estilo = jerarquia.estilo)
9. 405.372 2,337.904 ↑ 1.1 104,436 3 / 3

Hash Left Join (cost=30,483.96..78,002.44 rows=109,850 width=31) (actual time=1,371.715..2,337.904 rows=104,436 loops=3)

  • Hash Cond: (ventas.sku = stock.sku)
10. 566.304 580.152 ↑ 1.1 104,436 3 / 3

Parallel Bitmap Heap Scan on ventas (cost=9,989.85..53,029.98 rows=109,850 width=27) (actual time=17.971..580.152 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,652
11. 13.848 13.848 ↓ 1.2 313,307 1 / 3

Bitmap Index Scan on ventas_estado_fecha_sku_idx (cost=0.00..9,923.94 rows=263,640 width=0) (actual time=41.545..41.545 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))
12. 291.902 1,352.380 ↑ 1.0 550,360 3 / 3

Hash (cost=10,926.60..10,926.60 rows=550,360 width=13) (actual time=1,352.380..1,352.380 rows=550,360 loops=3)

  • Buckets: 131,072 Batches: 16 Memory Usage: 2,592kB
13. 1,060.478 1,060.478 ↑ 1.0 550,360 3 / 3

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

14. 744.523 2,525.008 ↓ 1.0 786,409 3 / 3

Hash (cost=23,613.60..23,613.60 rows=779,360 width=35) (actual time=2,525.007..2,525.008 rows=786,409 loops=3)

  • Buckets: 65,536 Batches: 16 Memory Usage: 3,772kB
15. 1,780.485 1,780.485 ↓ 1.0 786,409 3 / 3

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

16. 0.024 0.059 ↑ 1.0 66 3 / 3

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

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

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

  • Filter: (id_depto IS NOT NULL)