explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tefw : Optimization for: Optimization for: plan #K1Vh; plan #6HnL

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.624 2,032.894 ↓ 0.0 0 1

Update on episodios_alta_diagnosticos (cost=0.42..353,076.49 rows=28 width=26) (actual time=2,032.894..2,032.894 rows=0 loops=1)

2. 0.298 2,032.270 ↓ 1.0 29 1

Index Scan using episodios_alta_diagnosticos_pkey on episodios_alta_diagnosticos episodios_alta_diagnosticos (cost=0.42..353,076.49 rows=28 width=26) (actual time=74.469..2,032.27 rows=29 loops=1)

  • Index Cond: (id < 386655)
3.          

SubPlan (for Index Scan)

4. 0.174 2,031.972 ↑ 1.0 1 29

Limit (cost=12,609.55..12,609.55 rows=1 width=12) (actual time=70.066..70.068 rows=1 loops=29)

5. 675.758 2,031.798 ↑ 34,585.0 1 29

Sort (cost=12,609.55..12,696.01 rows=34,585 width=12) (actual time=70.062..70.062 rows=1 loops=29)

  • Sort Key: (random())
  • Sort Method: top-N heapsort Memory: 25kB
6. 1,030.602 1,356.040 ↓ 2.2 75,695 29

Bitmap Heap Scan on cies cies (cost=738.92..12,436.62 rows=34,585 width=12) (actual time=11.932..46.76 rows=75,695 loops=29)

  • Heap Blocks: exact=67,657
7. 325.438 325.438 ↓ 2.2 75,695 29

Bitmap Index Scan on cies_version_diagnostico (cost=0..730.27 rows=34,585 width=0) (actual time=11.222..11.222 rows=75,695 loops=29)

  • Index Cond: ((CASE WHEN (episodios_alta_diagnosticos.orden > '-1'::integer) THEN 6 ELSE 0 END = id_cie_version) AND (diagnostico_procedimiento = 'D'::bpchar))
Planning time : 0.268 ms
Execution time : 2,054.174 ms
Trigger times:
Trigger Name:Total time:Calls:Average time:
RI_ConstraintTrigger_c_125443 21.203 ms 29 0.731 ms