explain.depesz.com

PostgreSQL's explain analyze made readable

Result: S1gf

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..228,945,385.56 rows=7 width=331) (actual rows= loops=)

  • Join Filter: (itd_pac.centro_custo_unf_seq = unf.seq)
2. 0.000 0.000 ↓ 0.0

Seq Scan on agh_unidades_funcionais unf (cost=0.00..3.95 rows=95 width=29) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..228,945,371.58 rows=7 width=304) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..228,945,371.55 rows=7 width=304) (actual rows= loops=)

  • Join Filter: ((SubPlan 2) = itd_triagem.seq)
5. 0.000 0.000 ↓ 0.0

Seq Scan on itd_triagem (cost=0.00..2,244.27 rows=87,727 width=16) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..4,853.74 rows=7 width=304) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Seq Scan on itd_paciente itd_pac (cost=0.00..4,853.70 rows=7 width=304) (actual rows= loops=)

  • Filter: (((codigo_erro IS NOT NULL) OR (msg_erro IS NOT NULL)) AND (criado_em > (now() - '2 days'::interval)))
8.          

SubPlan (forNested Loop)

9. 0.000 0.000 ↓ 0.0

Result (cost=372.78..372.79 rows=1 width=0) (actual rows= loops=)

10.          

Initplan (forResult)

11. 0.000 0.000 ↓ 0.0

Limit (cost=0.29..372.78 rows=1 width=8) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Result (cost=0.29..4,097.68 rows=11 width=8) (actual rows= loops=)

  • One-Time Filter: (itd_pac.horario_envio_dados > itd_triagem.horario_envio_dados)
13. 0.000 0.000 ↓ 0.0

Index Scan Backward using itd_triagem_pk on itd_triagem itd_triagem_2 (cost=0.29..4,097.68 rows=11 width=8) (actual rows= loops=)

  • Index Cond: (seq IS NOT NULL)
  • Filter: (prontuario = itd_pac.prontuario)