explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6HnL : Optimization for: plan #K1Vh

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.609 3,509.111 ↓ 0.0 0 1

Update on episodios_alta_diagnosticos (cost=0.42..394,164.74 rows=28 width=26) (actual time=3,509.111..3,509.111 rows=0 loops=1)

2. 0.227 3,508.502 ↓ 1.0 29 1

Index Scan using episodios_alta_diagnosticos_pkey on episodios_alta_diagnosticos episodios_alta_diagnosticos (cost=0.42..394,164.74 rows=28 width=26) (actual time=133.448..3,508.502 rows=29 loops=1)

  • Index Cond: (id < 386655)
3.          

SubPlan (for Index Scan)

4. 0.203 3,508.275 ↑ 1.0 1 29

Limit (cost=14,076.98..14,076.99 rows=1 width=12) (actual time=120.971..120.975 rows=1 loops=29)

5. 690.258 3,508.072 ↑ 34,585.0 1 29

Sort (cost=14,076.98..14,163.45 rows=34,585 width=12) (actual time=120.968..120.968 rows=1 loops=29)

  • Sort Key: (random())
  • Sort Method: top-N heapsort Memory: 25kB
6. 2,362.224 2,817.814 ↓ 2.2 75,695 29

Bitmap Heap Scan on cies cies (cost=1,731.83..13,904.06 rows=34,585 width=12) (actual time=17.473..97.166 rows=75,695 loops=29)

  • Filter: (diagnostico_procedimiento = 'D'::bpchar)
  • Heap Blocks: exact=156,745
7. 455.590 455.590 ↓ 2.5 151,484 29

Bitmap Index Scan on cies_id_cie_version_codigo (cost=0..1,723.18 rows=61,701 width=0) (actual time=15.71..15.71 rows=151,484 loops=29)

  • Index Cond: (CASE WHEN (episodios_alta_diagnosticos.orden > '-1'::integer) THEN 6 ELSE 0 END = id_cie_version)
Planning time : 0.717 ms
Execution time : 3,539.371 ms
Trigger times:
Trigger Name:Total time:Calls:Average time:
RI_ConstraintTrigger_c_125443 30.136 ms 29 1.039 ms