explain.depesz.com

PostgreSQL's explain analyze made readable

Result: g7Ge

Settings
# exclusive inclusive rows x rows loops node
1. 0.080 484.558 ↑ 1.0 2 1

Nested Loop (cost=1,730.69..3,534.49 rows=2 width=385) (actual time=232.893..484.558 rows=2 loops=1)

2. 0.019 0.019 ↑ 1.0 1 1

Index Scan using pkconvenio on convenio (cost=0.28..8.29 rows=1 width=61) (actual time=0.014..0.019 rows=1 loops=1)

  • Index Cond: (id = 1115)
3. 0.007 484.255 ↑ 1.0 2 1

Nested Loop (cost=1,730.41..3,492.32 rows=2 width=161) (actual time=232.780..484.255 rows=2 loops=1)

4. 0.012 483.572 ↑ 1.0 1 1

Nested Loop (cost=1,730.13..2,963.65 rows=1 width=165) (actual time=232.687..483.572 rows=1 loops=1)

5. 22.366 483.533 ↑ 1.0 1 1

Hash Join (cost=1,729.84..2,963.28 rows=1 width=132) (actual time=232.650..483.533 rows=1 loops=1)

  • Hash Cond: (pessoa_pf.id_pessoa = paciente.id_pessoa_pf)
6. 45.310 461.151 ↑ 1.0 31,583 1

Hash Left Join (cost=1,721.52..2,872.05 rows=31,583 width=116) (actual time=88.266..461.151 rows=31,583 loops=1)

  • Hash Cond: (cidade.id_estado = estado.id)
  • Join Filter: (cidade.id_estado IS NOT NULL)
7. 46.920 415.775 ↑ 1.0 31,583 1

Hash Left Join (cost=1,719.91..2,774.52 rows=31,583 width=115) (actual time=88.187..415.775 rows=31,583 loops=1)

  • Hash Cond: (pessoa_pf_natural.id_cidade = cidade.id)
  • Join Filter: (pessoa_pf_natural.id_cidade IS NOT NULL)
8. 47.562 359.658 ↑ 1.0 31,583 1

Hash Left Join (cost=1,557.59..2,529.22 rows=31,583 width=100) (actual time=78.974..359.658 rows=31,583 loops=1)

  • Hash Cond: (pessoa_pf_natural.id_pais = pais.id)
  • Join Filter: (pessoa_pf_natural.id_pais IS NOT NULL)
9. 62.901 311.661 ↑ 1.0 31,583 1

Hash Left Join (cost=1,550.01..2,438.74 rows=31,583 width=93) (actual time=78.518..311.661 rows=31,583 loops=1)

  • Hash Cond: (pessoa_pf.id_pessoa = pessoa_pf_natural.id_pessoa)
10. 47.634 228.537 ↑ 1.0 31,583 1

Hash Left Join (cost=1,218.48..2,024.30 rows=31,583 width=85) (actual time=58.269..228.537 rows=31,583 loops=1)

  • Hash Cond: (pessoa_pf.id_est_civil = estado_civil.id)
  • Join Filter: (pessoa_pf.id_est_civil IS NOT NULL)
11. 43.658 180.871 ↑ 1.0 31,583 1

Hash Left Join (cost=1,217.37..1,922.12 rows=31,583 width=78) (actual time=58.211..180.871 rows=31,583 loops=1)

  • Hash Cond: (pessoa_pf.id_pf_resp = pessoa_resp.id)
  • Join Filter: (pessoa_pf.id_pf_resp IS NOT NULL)
12. 55.734 84.521 ↑ 1.0 31,583 1

Hash Left Join (cost=97.41..719.26 rows=31,583 width=53) (actual time=5.462..84.521 rows=31,583 loops=1)

  • Hash Cond: (pessoa_pf.id_ocupacao = ocupacao_pf.id)
  • Join Filter: (pessoa_pf.id_ocupacao IS NOT NULL)
13. 23.360 23.360 ↑ 1.0 31,583 1

Seq Scan on pessoa_pf (cost=0.00..538.83 rows=31,583 width=40) (actual time=0.021..23.360 rows=31,583 loops=1)

14. 2.828 5.427 ↑ 1.0 3,085 1

Hash (cost=58.85..58.85 rows=3,085 width=21) (actual time=5.426..5.427 rows=3,085 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 198kB
15. 2.599 2.599 ↑ 1.0 3,085 1

Seq Scan on ocupacao_pf (cost=0.00..58.85 rows=3,085 width=21) (actual time=0.010..2.599 rows=3,085 loops=1)

16. 27.214 52.692 ↑ 1.0 31,687 1

Hash (cost=723.87..723.87 rows=31,687 width=29) (actual time=52.692..52.692 rows=31,687 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 2167kB
17. 25.478 25.478 ↑ 1.0 31,687 1

Seq Scan on pessoa pessoa_resp (cost=0.00..723.87 rows=31,687 width=29) (actual time=0.022..25.478 rows=31,687 loops=1)

18. 0.009 0.032 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=15) (actual time=0.032..0.032 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
19. 0.023 0.023 ↑ 1.0 5 1

Seq Scan on estado_civil (cost=0.00..1.05 rows=5 width=15) (actual time=0.019..0.023 rows=5 loops=1)

20. 11.016 20.223 ↑ 1.0 12,290 1

Hash (cost=177.90..177.90 rows=12,290 width=12) (actual time=20.222..20.223 rows=12,290 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 609kB
21. 9.207 9.207 ↑ 1.0 12,290 1

Seq Scan on pessoa_pf_natural (cost=0.00..177.90 rows=12,290 width=12) (actual time=0.015..9.207 rows=12,290 loops=1)

22. 0.219 0.435 ↑ 1.0 248 1

Hash (cost=4.48..4.48 rows=248 width=13) (actual time=0.434..0.435 rows=248 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 20kB
23. 0.216 0.216 ↑ 1.0 248 1

Seq Scan on pais (cost=0.00..4.48 rows=248 width=13) (actual time=0.019..0.216 rows=248 loops=1)

24. 4.939 9.197 ↑ 1.0 5,570 1

Hash (cost=92.70..92.70 rows=5,570 width=17) (actual time=9.196..9.197 rows=5,570 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 334kB
25. 4.258 4.258 ↑ 1.0 5,570 1

Seq Scan on cidade (cost=0.00..92.70 rows=5,570 width=17) (actual time=0.013..4.258 rows=5,570 loops=1)

26. 0.030 0.066 ↑ 1.0 27 1

Hash (cost=1.27..1.27 rows=27 width=5) (actual time=0.065..0.066 rows=27 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
27. 0.036 0.036 ↑ 1.0 27 1

Seq Scan on estado (cost=0.00..1.27 rows=27 width=5) (actual time=0.014..0.036 rows=27 loops=1)

28. 0.005 0.016 ↑ 1.0 1 1

Hash (cost=8.30..8.30 rows=1 width=16) (actual time=0.016..0.016 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
29. 0.011 0.011 ↑ 1.0 1 1

Index Scan using pkpaciente on paciente (cost=0.29..8.30 rows=1 width=16) (actual time=0.009..0.011 rows=1 loops=1)

  • Index Cond: (id = 3091)
30. 0.027 0.027 ↑ 1.0 1 1

Index Scan using pkpessoa on pessoa (cost=0.29..0.37 rows=1 width=41) (actual time=0.027..0.027 rows=1 loops=1)

  • Index Cond: (id = pessoa_pf.id_pessoa)
  • Filter: (id_cliente = 11)
31. 0.676 0.676 ↑ 1.0 2 1

Index Only Scan using pkconv_paciente on conv_paciente (cost=0.29..528.64 rows=2 width=4) (actual time=0.089..0.676 rows=2 loops=1)

  • Index Cond: (id_paciente = 3091)
  • Heap Fetches: 2
32.          

SubPlan (forNested Loop)

33. 0.008 0.052 ↑ 1.0 1 2

Limit (cost=0.41..8.43 rows=1 width=32) (actual time=0.023..0.026 rows=1 loops=2)

34. 0.044 0.044 ↑ 1.0 1 2

Index Only Scan using pkpessoa_telefone on pessoa_telefone (cost=0.41..8.43 rows=1 width=32) (actual time=0.021..0.022 rows=1 loops=2)

  • Index Cond: (id_pessoa = pessoa.id)
  • Heap Fetches: 2
35. 0.004 0.152 ↓ 0.0 0 2

Limit (cost=0.41..8.43 rows=1 width=32) (actual time=0.075..0.076 rows=0 loops=2)

36. 0.148 0.148 ↓ 0.0 0 2

Index Only Scan using pkpessoa_telefone on pessoa_telefone pessoa_telefone_1 (cost=0.41..8.43 rows=1 width=32) (actual time=0.074..0.074 rows=0 loops=2)

  • Index Cond: (id_pessoa = pessoa_resp.id)
  • Heap Fetches: 0
Planning time : 3.935 ms