explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kHtJU

Settings
# exclusive inclusive rows x rows loops node
1. 5.216 991.600 ↓ 1.0 6,088 1

Sort (cost=61,892.34..61,907.51 rows=6,070 width=129) (actual time=990.807..991.600 rows=6,088 loops=1)

  • Sort Key: (sum(d.coste_total_administradas)) DESC
  • Sort Method: quicksort Memory: 1057kB
2. 4.218 986.384 ↓ 1.0 6,088 1

Hash Join (cost=61,105.04..61,510.91 rows=6,070 width=129) (actual time=980.252..986.384 rows=6,088 loops=1)

  • Hash Cond: (m.id = d.id_medicamento)
3. 1.962 1.962 ↑ 1.0 6,088 1

Seq Scan on prescripciones m (cost=0.00..389.88 rows=6,088 width=57) (actual time=0.018..1.962 rows=6,088 loops=1)

4. 2.337 980.204 ↓ 1.0 6,088 1

Hash (cost=61,029.17..61,029.17 rows=6,070 width=76) (actual time=980.204..980.204 rows=6,088 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 397kB
5. 5.179 977.867 ↓ 1.0 6,088 1

Sort (cost=60,953.29..60,968.47 rows=6,070 width=76) (actual time=976.796..977.867 rows=6,088 loops=1)

  • Sort Key: (sum(d.coste_total_administradas)) DESC
  • Sort Method: quicksort Memory: 668kB
6. 46.602 972.688 ↓ 1.0 6,088 1

Finalize HashAggregate (cost=60,480.82..60,571.87 rows=6,070 width=76) (actual time=967.730..972.688 rows=6,088 loops=1)

  • Group Key: d.id_medicamento
7. 17.668 926.086 ↓ 1.5 18,264 1

Gather (cost=58,963.32..60,268.37 rows=12,140 width=76) (actual time=905.436..926.086 rows=18,264 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
8. 358.936 908.418 ↓ 1.0 6,088 3 / 3

Partial HashAggregate (cost=57,963.32..58,054.37 rows=6,070 width=76) (actual time=896.567..908.418 rows=6,088 loops=3)

  • Group Key: d.id_medicamento
9. 549.482 549.482 ↑ 1.2 298,513 3 / 3

Parallel Seq Scan on dispensaciones_cache d (cost=0.00..53,336.01 rows=370,185 width=28) (actual time=141.165..549.482 rows=298,513 loops=3)

  • Filter: ((administraciond_normalizada >= 20180101) AND (administraciond_normalizada <= 20181231) AND (id_hospital = 290))
  • Rows Removed by Filter: 287102
Planning time : 0.487 ms
Execution time : 992.818 ms