explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OUQa : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #mWjY; plan #IrtJ; plan #wDLS; plan #l8Ca; plan #L3V6

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.069 738.929 ↑ 1.0 10 1

Limit (cost=50,768.78..50,768.80 rows=10 width=8) (actual time=738.860..738.929 rows=10 loops=1)

2. 0.631 738.860 ↑ 218.3 10 1

Sort (cost=50,768.78..50,774.23 rows=2,183 width=8) (actual time=738.859..738.860 rows=10 loops=1)

  • Sort Key: ((sum(coste_total_administradas) / sum(unidades_totales_administradas))) DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 2.737 738.229 ↑ 1.0 2,183 1

Finalize GroupAggregate (cost=50,650.66..50,721.60 rows=2,183 width=8) (actual time=734.534..738.229 rows=2,183 loops=1)

  • Group Key: id_medicamento
4. 4.524 735.492 ↓ 1.5 6,549 1

Sort (cost=50,650.66..50,661.57 rows=4,366 width=12) (actual time=734.525..735.492 rows=6,549 loops=1)

  • Sort Key: id_medicamento
  • Sort Method: quicksort Memory: 499kB
5. 14.369 730.968 ↓ 1.5 6,549 1

Gather (cost=49,928.25..50,386.68 rows=4,366 width=12) (actual time=724.707..730.968 rows=6,549 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 251.407 716.599 ↑ 1.0 2,183 3 / 3

Partial HashAggregate (cost=48,928.25..48,950.08 rows=2,183 width=12) (actual time=715.603..716.599 rows=2,183 loops=3)

  • Group Key: id_medicamento
7. 465.192 465.192 ↑ 1.2 291,715 3 / 3

Parallel Seq Scan on dispensaciones_cache d (cost=0.00..46,251.63 rows=356,883 width=12) (actual time=113.730..465.192 rows=291,715 loops=3)

  • Filter: ((administraciond_normalizada >= 20180101) AND (administraciond_normalizada <= 20181231) AND (id_hospital = 290))
  • Rows Removed by Filter: 269046
Planning time : 1.126 ms
Execution time : 739.046 ms