explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nGpe

Settings
# exclusive inclusive rows x rows loops node
1. 0.933 897.526 ↑ 1.0 200 1

Hash Join (cost=51,913.68..51,962.25 rows=200 width=74) (actual time=895.229..897.526 rows=200 loops=1)

2. 1.396 1.396 ↑ 1.0 2,183 1

Seq Scan on medicamentos m (cost=0..42.83 rows=2,183 width=34) (actual time=0.016..1.396 rows=2,183 loops=1)

3. 0.048 895.197 ↑ 1.0 200 1

Hash (cost=51,911.18..51,911.18 rows=200 width=44) (actual time=895.197..895.197 rows=200 loops=1)

4. 0.190 895.149 ↑ 1.0 200 1

Limit (cost=51,908.68..51,909.18 rows=200 width=44) (actual time=894.933..895.149 rows=200 loops=1)

5. 2.458 894.959 ↑ 10.9 200 1

Sort (cost=51,908.68..51,914.14 rows=2,183 width=44) (actual time=894.931..894.959 rows=200 loops=1)

  • Sort Key: (sum(d.dispensaciones)) DESC
  • Sort Method: top-N heapsort Memory: 51kB
6. 7.867 892.501 ↑ 1.0 2,183 1

GroupAggregate (cost=51,721.56..51,814.33 rows=2,183 width=44) (actual time=883.678..892.501 rows=2,183 loops=1)

  • Group Key: d.id_medicamento
7. 4.808 884.634 ↓ 1.5 6,549 1

Sort (cost=51,721.56..51,732.47 rows=4,366 width=44) (actual time=883.663..884.634 rows=6,549 loops=1)

  • Sort Key: d.id_medicamento
  • Sort Method: quicksort Memory: 704kB
8. 10.559 879.826 ↓ 1.5 6,549 1

Gather (cost=50,993.7..51,457.59 rows=4,366 width=44) (actual time=873.102..879.826 rows=6,549 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
9. 344.292 869.267 ↑ 1.0 2,183 3 / 3

HashAggregate (cost=49,993.7..50,020.99 rows=2,183 width=44) (actual time=866.474..869.267 rows=2,183 loops=3)

  • Group Key: d.id_medicamento
10. 524.975 524.975 ↑ 1.2 298,598 3 / 3

Seq Scan on dispensaciones_cache d (cost=0..46,386.66 rows=360,704 width=20) (actual time=121.872..524.975 rows=298,598 loops=3)

  • Filter: ((administraciond_normalizada >= 20,180,101) AND (administraciond_normalizada <= 20,181,231) AND (id_hospital = 290))
Planning time : 0.556 ms
Execution time : 897.777 ms