explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NpZl

Settings
# exclusive inclusive rows x rows loops node
1. 0.072 0.913 ↓ 5.0 5 1

Sort (cost=108.61..108.62 rows=1 width=5,621) (actual time=0.912..0.913 rows=5 loops=1)

  • Sort Key: aih0_.cod_aih DESC
  • Sort Method: quicksort Memory: 61kB
2. 0.024 0.841 ↓ 5.0 5 1

Nested Loop Left Join (cost=5.50..108.60 rows=1 width=5,621) (actual time=0.217..0.841 rows=5 loops=1)

3. 0.024 0.797 ↓ 5.0 5 1

Nested Loop Left Join (cost=5.08..101.58 rows=1 width=5,508) (actual time=0.206..0.797 rows=5 loops=1)

4. 0.022 0.773 ↓ 5.0 5 1

Nested Loop Anti Join (cost=4.79..100.32 rows=1 width=5,411) (actual time=0.201..0.773 rows=5 loops=1)

5. 0.025 0.741 ↓ 5.0 5 1

Nested Loop Left Join (cost=4.65..100.14 rows=1 width=5,368) (actual time=0.194..0.741 rows=5 loops=1)

  • Join Filter: ((subgrupo19_.cod_grupo)::text = (grupo20_.cod_grupo)::text)
  • Rows Removed by Join Filter: 19
6. 0.021 0.706 ↓ 5.0 5 1

Nested Loop Left Join (cost=4.65..98.96 rows=1 width=5,253) (actual time=0.186..0.706 rows=5 loops=1)

7. 0.022 0.670 ↓ 5.0 5 1

Nested Loop Left Join (cost=4.51..98.74 rows=1 width=5,136) (actual time=0.178..0.670 rows=5 loops=1)

8. 0.025 0.638 ↓ 5.0 5 1

Nested Loop Left Join (cost=4.24..98.44 rows=1 width=5,012) (actual time=0.171..0.638 rows=5 loops=1)

9. 0.019 0.593 ↓ 5.0 5 1

Nested Loop Left Join (cost=3.96..98.00 rows=1 width=4,633) (actual time=0.160..0.593 rows=5 loops=1)

10. 0.021 0.559 ↓ 5.0 5 1

Nested Loop Anti Join (cost=3.67..96.38 rows=1 width=4,246) (actual time=0.153..0.559 rows=5 loops=1)

11. 0.024 0.528 ↓ 5.0 5 1

Nested Loop Left Join (cost=3.53..96.21 rows=1 width=4,203) (actual time=0.144..0.528 rows=5 loops=1)

  • Join Filter: ((subgrupo23_.cod_grupo)::text = (grupo24_.cod_grupo)::text)
  • Rows Removed by Join Filter: 19
12. 0.024 0.489 ↓ 5.0 5 1

Nested Loop Left Join (cost=3.53..95.03 rows=1 width=4,088) (actual time=0.132..0.489 rows=5 loops=1)

13. 0.018 0.450 ↓ 5.0 5 1

Nested Loop Left Join (cost=3.39..94.80 rows=1 width=3,971) (actual time=0.121..0.450 rows=5 loops=1)

14. 0.023 0.417 ↓ 5.0 5 1

Nested Loop Left Join (cost=3.12..94.51 rows=1 width=3,847) (actual time=0.113..0.417 rows=5 loops=1)

15. 0.015 0.364 ↓ 5.0 5 1

Nested Loop Left Join (cost=2.84..94.07 rows=1 width=3,468) (actual time=0.097..0.364 rows=5 loops=1)

16. 0.018 0.324 ↓ 5.0 5 1

Nested Loop Left Join (cost=2.55..92.45 rows=1 width=3,081) (actual time=0.086..0.324 rows=5 loops=1)

  • Join Filter: (aihpacient4_.cod_paciente = paciente15_.cod_paciente)
17. 0.017 0.281 ↓ 5.0 5 1

Nested Loop Left Join (cost=2.13..83.99 rows=1 width=2,840) (actual time=0.072..0.281 rows=5 loops=1)

18. 0.013 0.244 ↓ 5.0 5 1

Nested Loop Left Join (cost=1.71..78.45 rows=1 width=2,424) (actual time=0.059..0.244 rows=5 loops=1)

19. 0.010 0.211 ↓ 5.0 5 1

Nested Loop (cost=1.42..70.14 rows=1 width=1,916) (actual time=0.050..0.211 rows=5 loops=1)

20. 0.010 0.176 ↓ 5.0 5 1

Nested Loop (cost=1.13..61.83 rows=1 width=1,408) (actual time=0.041..0.176 rows=5 loops=1)

21. 0.016 0.016 ↑ 1.0 1 1

Index Scan using ix_eas_cods on tb_eas eas1_ (cost=0.29..8.31 rows=1 width=508) (actual time=0.015..0.016 rows=1 loops=1)

  • Index Cond: ((cod_eas = 1482) AND (cod_eas_regional = 3960))
22. 0.014 0.150 ↓ 5.0 5 1

Nested Loop (cost=0.84..53.51 rows=1 width=900) (actual time=0.023..0.150 rows=5 loops=1)

23. 0.046 0.046 ↓ 3.8 15 1

Index Scan using idx_tb_aih_paciente_codpaciente on tb_aih_paciente aihpacient4_ (cost=0.42..19.72 rows=4 width=247) (actual time=0.011..0.046 rows=15 loops=1)

  • Index Cond: (cod_paciente = 2006889)
24. 0.090 0.090 ↓ 0.0 0 15

Index Scan using idx_tb_aih_codaih_seqalteracaoaih on tb_aih aih0_ (cost=0.42..8.45 rows=1 width=653) (actual time=0.006..0.006 rows=0 loops=15)

  • Index Cond: (cod_aih = aihpacient4_.cod_aih)
  • Filter: ((NOT historico) AND (dthr_exclusao IS NULL) AND (dt_inicio >= '2019-11-01'::date) AND (dt_inicio <= '2019-11-30'::date) AND (cod_eas = 1482))
  • Rows Removed by Filter: 1
25. 0.025 0.025 ↑ 1.0 1 5

Index Scan using ix_eas_cods on tb_eas eas13_ (cost=0.29..8.30 rows=1 width=508) (actual time=0.004..0.005 rows=1 loops=5)

  • Index Cond: (cod_eas = 3960)
26. 0.020 0.020 ↑ 1.0 1 5

Index Scan using ix_eas_cods on tb_eas eas14_ (cost=0.29..8.30 rows=1 width=508) (actual time=0.004..0.004 rows=1 loops=5)

  • Index Cond: (eas1_.cod_eas_secretaria_municipal_saude = cod_eas)
27. 0.020 0.020 ↑ 1.0 1 5

Index Scan using pk_profissional_saude on tb_profissional_saude profission3_ (cost=0.42..5.54 rows=1 width=416) (actual time=0.004..0.004 rows=1 loops=5)

  • Index Cond: (aih0_.id_profissional_autorizador = id_profissional)
28. 0.025 0.025 ↑ 1.0 1 5

Index Scan using pk_paciente on tb_paciente paciente15_ (cost=0.43..8.45 rows=1 width=241) (actual time=0.005..0.005 rows=1 loops=5)

  • Index Cond: (cod_paciente = 2006889)
29. 0.025 0.025 ↑ 1.0 1 5

Index Scan using pk_fat_procedimento on tb_fat_procedimento fatprocedi7_ (cost=0.29..1.62 rows=1 width=387) (actual time=0.005..0.005 rows=1 loops=5)

  • Index Cond: (aih0_.cod_fat_procedimento_solicitado = cod_fat_procedimento)
30. 0.030 0.030 ↑ 1.0 1 5

Index Scan using pk_procedimento on tb_procedimento procedimen21_ (cost=0.28..0.44 rows=1 width=379) (actual time=0.006..0.006 rows=1 loops=5)

  • Index Cond: ((fatprocedi7_.cod_procedimento)::text = (cod_procedimento)::text)
31. 0.015 0.015 ↑ 1.0 1 5

Index Scan using pk_forma_organizacao on tb_forma_organizacao formaorgan22_ (cost=0.27..0.30 rows=1 width=124) (actual time=0.003..0.003 rows=1 loops=5)

  • Index Cond: (fatprocedi7_.id_forma_organizacao = id_forma_organizacao)
32. 0.015 0.015 ↑ 1.0 1 5

Index Scan using pk_subgrupo on tb_subgrupo subgrupo23_ (cost=0.14..0.22 rows=1 width=117) (actual time=0.003..0.003 rows=1 loops=5)

  • Index Cond: (((formaorgan22_.cod_grupo)::text = (cod_grupo)::text) AND ((formaorgan22_.cod_subgrupo)::text = (cod_subgrupo)::text))
33. 0.015 0.015 ↑ 1.6 5 5

Seq Scan on tb_grupo grupo24_ (cost=0.00..1.08 rows=8 width=115) (actual time=0.002..0.003 rows=5 loops=5)

34. 0.010 0.010 ↓ 0.0 0 5

Index Scan using idx_tb_procedimento_transplante_codprocedimento on tb_procedimento_transplante procedimen26_ (cost=0.14..0.16 rows=1 width=43) (actual time=0.002..0.002 rows=0 loops=5)

  • Index Cond: ((fatprocedi7_.cod_procedimento)::text = (cod_procedimento)::text)
35. 0.015 0.015 ↑ 1.0 1 5

Index Scan using pk_fat_procedimento on tb_fat_procedimento fatprocedi8_ (cost=0.29..1.62 rows=1 width=387) (actual time=0.003..0.003 rows=1 loops=5)

  • Index Cond: (aih0_.cod_fat_procedimento_principal = cod_fat_procedimento)
36. 0.020 0.020 ↑ 1.0 1 5

Index Scan using pk_procedimento on tb_procedimento procedimen17_ (cost=0.28..0.44 rows=1 width=379) (actual time=0.004..0.004 rows=1 loops=5)

  • Index Cond: ((fatprocedi8_.cod_procedimento)::text = (cod_procedimento)::text)
37. 0.010 0.010 ↑ 1.0 1 5

Index Scan using pk_forma_organizacao on tb_forma_organizacao formaorgan18_ (cost=0.27..0.30 rows=1 width=124) (actual time=0.002..0.002 rows=1 loops=5)

  • Index Cond: (fatprocedi8_.id_forma_organizacao = id_forma_organizacao)
38. 0.015 0.015 ↑ 1.0 1 5

Index Scan using pk_subgrupo on tb_subgrupo subgrupo19_ (cost=0.14..0.22 rows=1 width=117) (actual time=0.003..0.003 rows=1 loops=5)

  • Index Cond: (((formaorgan18_.cod_grupo)::text = (cod_grupo)::text) AND ((formaorgan18_.cod_subgrupo)::text = (cod_subgrupo)::text))
39. 0.010 0.010 ↑ 1.6 5 5

Seq Scan on tb_grupo grupo20_ (cost=0.00..1.08 rows=8 width=115) (actual time=0.001..0.002 rows=5 loops=5)

40. 0.010 0.010 ↓ 0.0 0 5

Index Scan using idx_tb_procedimento_transplante_codprocedimento on tb_procedimento_transplante procedimen25_ (cost=0.14..0.16 rows=1 width=43) (actual time=0.002..0.002 rows=0 loops=5)

  • Index Cond: ((fatprocedi8_.cod_procedimento)::text = (cod_procedimento)::text)
41. 0.000 0.000 ↓ 0.0 0 5

Index Scan using pk_usuario_eas on tb_usuario_eas usuarioeas10_ (cost=0.29..1.26 rows=1 width=97) (actual time=0.000..0.000 rows=0 loops=5)

  • Index Cond: (aih0_.cod_usuario_eas_bloqueio = cod_usuario_eas)
42. 0.020 0.020 ↓ 0.0 0 5

Index Scan using idx_tb_aih_procedimento_codaih on tb_aih_procedimento listaproce12_ (cost=0.42..6.97 rows=5 width=105) (actual time=0.004..0.004 rows=0 loops=5)

  • Index Cond: (aih0_.cod_aih = cod_aih)
Planning time : 21.139 ms
Execution time : 2.963 ms