explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BXUf

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 89.788 5,012.440 ↓ 1.6 64,654 1

Sort (cost=156,725.59..156,826.05 rows=40,186 width=157) (actual time=4,989.801..5,012.440 rows=64,654 loops=1)

  • Sort Key: source.sum DESC
  • Sort Method: external merge Disk: 6,736kB
2. 286.617 4,922.652 ↓ 1.6 64,654 1

Hash Left Join (cost=123,207.33..150,491.98 rows=40,186 width=157) (actual time=4,196.718..4,922.652 rows=64,654 loops=1)

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

Hash Right Join (cost=83,549.13..102,042.43 rows=40,186 width=125) (actual time=2,437.502..2,877.423 rows=64,654 loops=1)

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

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

5. 51.690 2,437.420 ↓ 1.6 64,654 1

Hash (cost=82,300.80..82,300.80 rows=40,186 width=121) (actual time=2,437.420..2,437.420 rows=64,654 loops=1)

  • Buckets: 32,768 Batches: 2 Memory Usage: 2,879kB
6. 53.589 2,385.730 ↓ 1.6 64,654 1

Subquery Scan on source (cost=68,040.25..82,300.80 rows=40,186 width=121) (actual time=1,758.120..2,385.730 rows=64,654 loops=1)

7. 191.822 2,332.141 ↓ 1.6 64,654 1

Finalize GroupAggregate (cost=68,040.25..81,898.94 rows=40,186 width=153) (actual time=1,758.119..2,332.141 rows=64,654 loops=1)

  • Group Key: ventas.sku
8. 251.884 2,140.319 ↓ 1.3 107,406 1

Gather Merge (cost=68,040.25..80,191.04 rows=80,372 width=121) (actual time=1,758.098..2,140.319 rows=107,406 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
9. 86.407 1,888.435 ↑ 1.1 35,802 3 / 3

Partial GroupAggregate (cost=67,040.22..69,914.09 rows=40,186 width=121) (actual time=1,741.715..1,888.435 rows=35,802 loops=3)

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

Sort (cost=67,040.22..67,314.89 rows=109,867 width=27) (actual time=1,741.705..1,802.028 rows=103,062 loops=3)

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

Hash Semi Join (cost=10,652.05..55,209.39 rows=109,867 width=27) (actual time=70.911..587.510 rows=103,062 loops=3)

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

Parallel Bitmap Heap Scan on ventas (cost=10,649.57..53,696.23 rows=109,867 width=27) (actual time=70.826..451.258 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) AND (sku IS NOT NULL))
  • Filter: (estado ~~ 'paid'::text)
  • Heap Blocks: exact=1,656
13. 27.078 27.078 ↓ 1.2 313,307 1 / 3

Bitmap Index Scan on ventas_estado_fecha_sku_idx (cost=0.00..10,583.65 rows=263,680 width=0) (actual time=81.233..81.233 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) AND (sku IS NOT NULL))
14. 0.023 0.057 ↑ 1.0 66 3 / 3

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
15. 0.034 0.034 ↑ 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.034 rows=66 loops=3)

  • Filter: (id_depto IS NOT NULL)
16. 366.377 1,758.612 ↑ 1.0 786,409 1

Hash (cost=23,684.09..23,684.09 rows=786,409 width=35) (actual time=1,758.612..1,758.612 rows=786,409 loops=1)

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

Seq Scan on jerarquia (cost=0.00..23,684.09 rows=786,409 width=35) (actual time=0.604..1,392.235 rows=786,409 loops=1)