explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Pk3Y

Settings
# exclusive inclusive rows x rows loops node
1. 68.553 25,712.602 ↓ 3,807.0 3,807 1

Sort (cost=101,578.64..101,578.64 rows=1 width=926) (actual time=25,711.809..25,712.602 rows=3,807 loops=1)

  • Sort Key: agend.data, sa.prk
  • Sort Method: quicksort Memory: 2059kB
2. 6.072 25,644.049 ↓ 3,807.0 3,807 1

Nested Loop Anti Join (cost=8,013.62..101,578.63 rows=1 width=926) (actual time=2,863.874..25,644.049 rows=3,807 loops=1)

3. 8.554 25,603.678 ↓ 3,811.0 3,811 1

Nested Loop (cost=8,013.20..101,564.96 rows=1 width=914) (actual time=2,861.186..25,603.678 rows=3,811 loops=1)

4. 6.615 25,290.244 ↓ 3,811.0 3,811 1

Nested Loop (cost=8,012.77..101,557.86 rows=1 width=765) (actual time=2,858.727..25,290.244 rows=3,811 loops=1)

5. 8.241 25,268.385 ↓ 3,811.0 3,811 1

Nested Loop (cost=8,012.48..101,550.95 rows=1 width=736) (actual time=2,856.160..25,268.385 rows=3,811 loops=1)

6. 0.000 25,248.711 ↓ 3,811.0 3,811 1

Nested Loop (cost=8,012.20..101,542.65 rows=1 width=712) (actual time=2,852.567..25,248.711 rows=3,811 loops=1)

7. 0.000 25,248.563 ↓ 3,811.0 3,811 1

Gather (cost=8,012.06..101,537.24 rows=1 width=660) (actual time=2,851.426..25,248.563 rows=3,811 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
8. 75.837 25,510.787 ↓ 1,270.0 1,270 3

Nested Loop (cost=7,012.06..100,537.14 rows=1 width=660) (actual time=9,871.519..25,510.787 rows=1,270 loops=3)

9. 23.398 25,434.947 ↓ 1,350.1 16,201 3

Hash Join (cost=7,011.76..100,454.23 rows=12 width=660) (actual time=402.049..25,434.947 rows=16,201 loops=3)

  • Hash Cond: (sa."frkConvenio" = plano.prk)
10. 5,850.030 25,409.036 ↓ 8.5 21,137 3

Nested Loop (cost=6,978.53..100,414.49 rows=2,475 width=240) (actual time=364.892..25,409.036 rows=21,137 loops=3)

11. 19.704 19,558.731 ↓ 8.8 21,137 3

Hash Left Join (cost=6,978.09..78,725.63 rows=2,402 width=223) (actual time=362.922..19,558.731 rows=21,137 loops=3)

  • Hash Cond: (prest."frkUfConselhoProfissional" = e.prk)
12. 22.428 19,538.262 ↓ 8.8 21,137 3

Hash Left Join (cost=6,952.57..78,693.77 rows=2,402 width=203) (actual time=362.021..19,538.262 rows=21,137 loops=3)

  • Hash Cond: (prest."frkConselhoProfissional" = cp.prk)
13. 45.490 19,515.605 ↓ 8.8 21,137 3

Hash Join (cost=6,934.47..78,669.31 rows=2,402 width=151) (actual time=361.769..19,515.605 rows=21,137 loops=3)

  • Hash Cond: (ate."frkPrestador" = prest.prk)
14. 2,938.960 19,419.696 ↓ 8.8 21,137 3

Nested Loop (cost=6,174.32..77,902.85 rows=2,402 width=118) (actual time=309.798..19,419.696 rows=21,137 loops=3)

15. 1,773.198 16,480.677 ↓ 20.5 49,314 3

Nested Loop (cost=6,173.89..59,853.16 rows=2,402 width=82) (actual time=303.876..16,480.677 rows=49,314 loops=3)

16. 6,578.967 14,707.447 ↓ 21.9 52,687 3

Nested Loop (cost=6,173.46..42,884.01 rows=2,402 width=54) (actual time=303.087..14,707.447 rows=52,687 loops=3)

17. 7,960.769 8,128.357 ↓ 21.9 52,693 3

Parallel Bitmap Heap Scan on "ServicoAgendado" sa (cost=6,173.03..24,676.01 rows=2,402 width=50) (actual time=302.270..8,128.357 rows=52,693 loops=3)

  • Recheck Cond: (("frkUnidadeAdministrativaLocalAgendamento" = 1263) AND ("frkCliente" = 189))
  • Heap Blocks: exact=17445
18. 4.673 167.588 ↓ 0.0 0 1

BitmapAnd (cost=6,173.03..6,173.03 rows=5,766 width=0) (actual time=167.588..167.588 rows=0 loops=1)

19. 95.011 95.011 ↑ 1.0 158,078 1

Bitmap Index Scan on "ServicoAgendado_UnidAge" (cost=0.00..3,030.73 rows=163,506 width=0) (actual time=95.011..95.011 rows=158,078 loops=1)

  • Index Cond: ("frkUnidadeAdministrativaLocalAgendamento" = 1263)
20. 67.904 67.904 ↑ 1.0 163,520 1

Bitmap Index Scan on "ServicoAgendado_idx_frkCliente" (cost=0.00..3,139.17 rows=169,432 width=0) (actual time=67.904..67.904 rows=163,520 loops=1)

  • Index Cond: ("frkCliente" = 189)
21. 0.123 0.123 ↑ 1.0 1 158,078

Index Scan using "PacienteAgendado_pkey" on "PacienteAgendado" pa (cost=0.43..7.58 rows=1 width=12) (actual time=0.123..0.123 rows=1 loops=158,078)

  • Index Cond: (prk = sa."frkPacienteAgendado")
22. 0.032 0.032 ↑ 1.0 1 158,061

Index Scan using "Paciente_pkey" on "Paciente" pac (cost=0.43..7.06 rows=1 width=36) (actual time=0.032..0.032 rows=1 loops=158,061)

  • Index Cond: (prk = pa."frkPaciente")
23. 0.059 0.059 ↓ 0.0 0 147,943

Index Scan using "Atendimento_pkey" on "Atendimento" ate (cost=0.43..7.51 rows=1 width=36) (actual time=0.059..0.059 rows=0 loops=147,943)

  • Index Cond: (prk = sa."frkAtendimento")
24. 13.270 50.419 ↓ 1.0 9,682 3

Hash (cost=639.51..639.51 rows=9,651 width=37) (actual time=50.418..50.419 rows=9,682 loops=3)

  • Buckets: 16384 Batches: 1 Memory Usage: 773kB
25. 37.149 37.149 ↓ 1.0 9,682 3

Seq Scan on "Prestador" prest (cost=0.00..639.51 rows=9,651 width=37) (actual time=0.022..37.149 rows=9,682 loops=3)

26. 0.115 0.229 ↑ 18.0 20 3

Hash (cost=13.60..13.60 rows=360 width=60) (actual time=0.228..0.229 rows=20 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
27. 0.114 0.114 ↑ 18.0 20 3

Seq Scan on "ConselhoProfissional" cp (cost=0.00..13.60 rows=360 width=60) (actual time=0.108..0.114 rows=20 loops=3)

28. 0.409 0.765 ↑ 25.6 27 3

Hash (cost=16.90..16.90 rows=690 width=28) (actual time=0.765..0.765 rows=27 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
29. 0.356 0.356 ↑ 25.6 27 3

Seq Scan on "Estado" e (cost=0.00..16.90 rows=690 width=28) (actual time=0.347..0.356 rows=27 loops=3)

30. 0.275 0.275 ↑ 2.0 1 63,411

Index Scan using "ServicoAgendadoServico_Sa" on "ServicoAgendadoServico" sas (cost=0.43..9.01 rows=2 width=21) (actual time=0.273..0.275 rows=1 loops=63,411)

  • Index Cond: ("frkServicoAgendado" = sa.prk)
31. 0.201 2.513 ↑ 4.5 2 3

Hash (cost=33.13..33.13 rows=9 width=424) (actual time=2.512..2.513 rows=2 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
32. 0.282 2.312 ↑ 4.5 2 3

Bitmap Heap Scan on "PlanoSaude" plano (cost=4.35..33.13 rows=9 width=424) (actual time=2.303..2.312 rows=2 loops=3)

  • Recheck Cond: ("frkOperadoraPlanoSaude" = 2034)
  • Heap Blocks: exact=2
33. 2.030 2.030 ↑ 4.5 2 3

Bitmap Index Scan on "PlanoSaude_idx1" (cost=0.00..4.34 rows=9 width=0) (actual time=2.030..2.030 rows=2 loops=3)

  • Index Cond: ("frkOperadoraPlanoSaude" = 2034)
34. 0.003 0.003 ↓ 0.0 0 48,602

Index Scan using "Agenda_pkey" on "Agenda" agend (cost=0.29..6.91 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=48,602)

  • Index Cond: (prk = sa."frkAgenda")
  • Filter: ((data >= '2019-05-28'::date) AND (data <= '2019-09-05'::date))
  • Rows Removed by Filter: 1
35. 7.622 7.622 ↑ 1.0 1 3,811

Index Scan using "Especialidade_pkey" on "Especialidade" espld (cost=0.14..5.36 rows=1 width=60) (actual time=0.002..0.002 rows=1 loops=3,811)

  • Index Cond: (prk = sa."frkEspecialidade")
36. 11.433 11.433 ↑ 1.0 1 3,811

Index Scan using "OperadoraPlanoSaude_pkey" on "OperadoraPlanoSaude" oplano (cost=0.28..8.29 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=3,811)

  • Index Cond: (prk = 2034)
37. 15.244 15.244 ↑ 1.0 1 3,811

Index Scan using "Servico_pkey" on "Servico" serv (cost=0.29..6.91 rows=1 width=33) (actual time=0.004..0.004 rows=1 loops=3,811)

  • Index Cond: (prk = sas."frkServico")
  • Filter: ((tipo <> 'R'::bpchar) AND (tipo <> 'C'::bpchar))
38. 304.880 304.880 ↑ 1.0 1 3,811

Index Scan using "ServicoPrestado_idx" on "ServicoPrestado" servp (cost=0.43..7.09 rows=1 width=157) (actual time=0.079..0.080 rows=1 loops=3,811)

  • Index Cond: ("frkAtendimento" = ate.prk)
39. 34.299 34.299 ↓ 0.0 0 3,811

Index Scan using "TissGuia_pkey" on "TissGuia" tg (cost=0.42..7.04 rows=1 width=12) (actual time=0.009..0.009 rows=0 loops=3,811)

  • Index Cond: ("frkServicoPrestado" = servp.prk)
Planning time : 72.559 ms
Execution time : 25,741.358 ms