explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Jl8w

Settings
# exclusive inclusive rows x rows loops node
1. 0.310 13,080.478 ↑ 1.0 100 1

Limit (cost=920,812.88..941,754.27 rows=100 width=2,123) (actual time=13,079.643..13,080.478 rows=100 loops=1)

2. 0.159 13,080.168 ↑ 5.8 100 1

Result (cost=920,812.88..1,043,110.60 rows=584 width=2,123) (actual time=13,079.640..13,080.168 rows=100 loops=1)

3. 6.462 13,079.609 ↑ 5.8 100 1

Sort (cost=920,812.88..921,104.88 rows=584 width=2,067) (actual time=13,079.596..13,079.609 rows=100 loops=1)

  • Sort Key: (sum((COALESCE(guiaconvenio.guivalortotal, '0'::numeric) - COALESCE(guiaprestador.guivalortotal, '0'::numeric))) OVER (?)), remessaparafiltro.rem_numero, ((COALESCE(guiaconvenio.guivalortotal, '0'::numeric) - COALESCE(guiaprestador.guivalortotal, '0'::numeric)))
  • Sort Method: top-N heapsort Memory: 76kB
4. 12.574 13,073.147 ↓ 4.0 2,311 1

WindowAgg (cost=905,252.87..916,348.87 rows=584 width=2,067) (actual time=13,060.323..13,073.147 rows=2,311 loops=1)

5. 3.490 13,060.573 ↓ 4.0 2,311 1

Sort (cost=905,252.87..905,544.87 rows=584 width=1,561) (actual time=13,060.194..13,060.573 rows=2,311 loops=1)

  • Sort Key: remessaparafiltro.rem_numero
  • Sort Method: quicksort Memory: 710kB
6. 20.293 13,057.083 ↓ 4.0 2,311 1

WindowAgg (cost=111,771.38..899,886.01 rows=584 width=1,561) (actual time=13,055.018..13,057.083 rows=2,311 loops=1)

7. 1.614 13,032.168 ↓ 4.0 2,311 1

Nested Loop Left Join (cost=111,771.38..824,137.15 rows=584 width=561) (actual time=11,842.426..13,032.168 rows=2,311 loops=1)

8. 191.394 12,982.023 ↓ 4.0 2,311 1

Gather (cost=111,396.00..604,036.65 rows=584 width=337) (actual time=11,803.886..12,982.023 rows=2,311 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
9. 0.477 12,790.629 ↓ 3.1 578 4 / 4

Nested Loop Left Join (cost=110,396.00..602,978.25 rows=188 width=337) (actual time=11,969.724..12,790.629 rows=578 loops=4)

10. 0.486 12,790.152 ↓ 3.1 578 4 / 4

Nested Loop Left Join (cost=110,310.00..586,417.56 rows=188 width=330) (actual time=11,969.718..12,790.152 rows=578 loops=4)

11. 0.449 12,789.666 ↓ 3.1 578 4 / 4

Nested Loop Left Join (cost=110,224.00..569,838.26 rows=188 width=294) (actual time=11,969.710..12,789.666 rows=578 loops=4)

12. 0.522 12,789.217 ↓ 3.1 578 4 / 4

Nested Loop Left Join (cost=110,138.00..553,277.59 rows=188 width=288) (actual time=11,969.703..12,789.217 rows=578 loops=4)

13. 0.278 12,788.695 ↓ 3.1 578 4 / 4

Hash Left Join (cost=110,052.00..536,698.29 rows=188 width=247) (actual time=11,969.697..12,788.695 rows=578 loops=4)

  • Hash Cond: (guiaprestador.guistatusanaliseglosa = status_analise_prestador.stcodigo)
14. 0.276 12,788.402 ↓ 3.1 578 4 / 4

Hash Left Join (cost=110,028.00..536,508.79 rows=188 width=234) (actual time=11,969.667..12,788.402 rows=578 loops=4)

  • Hash Cond: (guiaconvenio.guistatusconciliacao = status_conciliacao_convenio.stcodigo)
15. 0.271 12,788.102 ↓ 3.1 578 4 / 4

Hash Left Join (cost=110,004.00..536,249.79 rows=188 width=221) (actual time=11,969.618..12,788.102 rows=578 loops=4)

  • Hash Cond: (guiaconvenio.guisituacaoguia = situacao_guia_convenio.sitcodigo)
16. 0.557 12,787.799 ↓ 3.1 578 4 / 4

Hash Join (cost=109,965.00..535,975.79 rows=188 width=205) (actual time=11,969.559..12,787.799 rows=578 loops=4)

  • Hash Cond: (guiaprestador.guistatusconciliacao = status_conciliacao_prestador.stcodigo)
17. 0.403 12,787.212 ↓ 3.1 578 4 / 4

Hash Join (cost=109,941.00..535,716.79 rows=188 width=192) (actual time=11,969.350..12,787.212 rows=578 loops=4)

  • Hash Cond: (guiaprestador.guisituacaoguia = situacao_guia_prestador.sitcodigo)
18. 0.352 12,786.788 ↓ 3.1 578 4 / 4

Nested Loop (cost=109,902.00..535,442.79 rows=188 width=176) (actual time=11,969.306..12,786.788 rows=578 loops=4)

19. 0.408 12,781.814 ↓ 3.1 578 4 / 4

Hash Join (cost=109,873.50..529,144.79 rows=188 width=183) (actual time=11,966.821..12,781.814 rows=578 loops=4)

  • Hash Cond: (protocoloprestadorparafiltro.hospital = hospitalprestadorparafiltro.id)
20. 0.310 12,781.389 ↓ 3.1 578 4 / 4

Nested Loop Left Join (cost=109,869.00..528,905.29 rows=188 width=191) (actual time=11,966.744..12,781.389 rows=578 loops=4)

21. 3.473 12,682.862 ↓ 3.1 578 4 / 4

Hash Join (cost=109,783.00..512,326.01 rows=188 width=146) (actual time=11,919.938..12,682.862 rows=578 loops=4)

  • Hash Cond: (guiaprestador.guiremessa = remessaparafiltro.id)
22. 12.078 12,659.904 ↓ 6.7 15,906 4 / 4

Nested Loop (cost=86.00..400,800.51 rows=2,372 width=147) (actual time=65.731..12,659.904 rows=15,906 loops=4)

23. 293.087 293.087 ↑ 1.3 1,115 4 / 4

Parallel Seq Scan on fiboprotocolo protocoloprestadorparafiltro (cost=0.00..213,780.19 rows=1,405 width=24) (actual time=15.320..293.087 rows=1,115 loops=4)

  • Filter: (convenio = 'Amil'::text)
  • Rows Removed by Filter: 151,608
24. 12,354.739 12,354.739 ↓ 2.3 14 4,461 / 4

Index Scan using idx_fiboguia_guiprotocolo_idx on fiboguia guiaprestador (cost=86.00..130.11 rows=6 width=139) (actual time=7.264..11.078 rows=14 loops=4,461)

  • Index Cond: (guiprotocolo = protocoloprestadorparafiltro.id)
  • Filter: ((discriminador <> ALL ('{RECURSO,ESTORNO}'::text[])) AND (guiorigem = 'HOSPITAL'::text))
  • Rows Removed by Filter: 7
25. 1.095 19.485 ↓ 1.0 5,426 4 / 4

Hash (cost=104,286.00..104,286.00 rows=5,411 width=15) (actual time=19.485..19.485 rows=5,426 loops=4)

  • Buckets: 8,192 Batches: 1 Memory Usage: 319kB
26. 18.390 18.390 ↓ 1.0 5,426 4 / 4

Seq Scan on fiboremessa remessaparafiltro (cost=0.00..104,286.00 rows=5,411 width=15) (actual time=3.425..18.390 rows=5,426 loops=4)

  • Filter: ((remdtvenc >= '2020-01-01'::date) AND (remdtvenc < '2020-05-02'::date))
  • Rows Removed by Filter: 62,607
27. 98.218 98.218 ↓ 0.0 0 2,311 / 4

Index Scan using idx_fiboguia_guiguiaassoc_idx on fiboguia guiaconvenio (cost=86.00..87.69 rows=1 width=53) (actual time=0.170..0.170 rows=0 loops=2,311)

  • Index Cond: (guiguiaassoc = guiaprestador.id)
28. 0.004 0.017 ↑ 1.0 2 4 / 4

Hash (cost=2.50..2.50 rows=2 width=8) (actual time=0.017..0.017 rows=2 loops=4)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
29. 0.013 0.013 ↑ 1.0 2 4 / 4

Seq Scan on fibohospital hospitalprestadorparafiltro (cost=0.00..2.50 rows=2 width=8) (actual time=0.013..0.013 rows=2 loops=4)

30. 4.622 4.622 ↑ 1.0 1 2,311 / 4

Index Scan using fiboconvenio_convnome_unique on fiboconvenio convenio (cost=28.50..33.00 rows=1 width=10) (actual time=0.008..0.008 rows=1 loops=2,311)

  • Index Cond: (convnome = 'Amil'::text)
31. 0.007 0.021 ↑ 1.0 25 4 / 4

Hash (cost=14.00..14.00 rows=25 width=30) (actual time=0.021..0.021 rows=25 loops=4)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
32. 0.014 0.014 ↑ 1.0 25 4 / 4

Seq Scan on fibosituacaoguia situacao_guia_prestador (cost=0.00..14.00 rows=25 width=30) (actual time=0.011..0.014 rows=25 loops=4)

33. 0.010 0.030 ↑ 1.0 15 4 / 4

Hash (cost=9.00..9.00 rows=15 width=25) (actual time=0.030..0.030 rows=15 loops=4)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
34. 0.020 0.020 ↑ 1.0 15 4 / 4

Seq Scan on fibostatusguia status_conciliacao_prestador (cost=0.00..9.00 rows=15 width=25) (actual time=0.018..0.020 rows=15 loops=4)

35. 0.016 0.032 ↑ 1.0 25 4 / 4

Hash (cost=14.00..14.00 rows=25 width=30) (actual time=0.032..0.032 rows=25 loops=4)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
36. 0.016 0.016 ↑ 1.0 25 4 / 4

Seq Scan on fibosituacaoguia situacao_guia_convenio (cost=0.00..14.00 rows=25 width=30) (actual time=0.011..0.016 rows=25 loops=4)

37. 0.015 0.024 ↑ 1.0 15 4 / 4

Hash (cost=9.00..9.00 rows=15 width=25) (actual time=0.024..0.024 rows=15 loops=4)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
38. 0.009 0.009 ↑ 1.0 15 4 / 4

Seq Scan on fibostatusguia status_conciliacao_convenio (cost=0.00..9.00 rows=15 width=25) (actual time=0.006..0.009 rows=15 loops=4)

39. 0.010 0.015 ↑ 1.0 15 4 / 4

Hash (cost=9.00..9.00 rows=15 width=25) (actual time=0.015..0.015 rows=15 loops=4)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
40. 0.005 0.005 ↑ 1.0 15 4 / 4

Seq Scan on fibostatusguia status_analise_prestador (cost=0.00..9.00 rows=15 width=25) (actual time=0.003..0.005 rows=15 loops=4)

41. 0.000 0.000 ↓ 0.0 0 2,311 / 4

Index Scan using fiboguia_pkey on fiboguia ultimo_recurso_prestador (cost=86.00..87.69 rows=1 width=49) (actual time=0.000..0.000 rows=0 loops=2,311)

  • Index Cond: (id = guiaprestador.ultimo_recurso_id)
42. 0.000 0.000 ↓ 0.0 0 2,311 / 4

Index Scan using idx_fiboguia_guiguiaassoc_idx on fiboguia ultimo_pagamento_recurso (cost=86.00..87.59 rows=1 width=14) (actual time=0.000..0.000 rows=0 loops=2,311)

  • Index Cond: (ultimo_recurso_prestador.id = guiguiaassoc)
43. 0.000 0.000 ↓ 0.0 0 2,311 / 4

Index Scan using fiboguia_pkey on fiboguia guiarecurso (cost=86.00..87.69 rows=1 width=52) (actual time=0.000..0.000 rows=0 loops=2,311)

  • Index Cond: (guiaprestador.guia_recurso_id = id)
44. 0.000 0.000 ↓ 0.0 0 2,311 / 4

Index Scan using fiboguia_pkey on fiboguia pagamentoderecurso (cost=86.00..87.59 rows=1 width=23) (actual time=0.000..0.000 rows=0 loops=2,311)

  • Index Cond: (id = guiarecurso.guiguiaassoc)
45. 2.311 48.531 ↑ 1.0 1 2,311

Aggregate (cost=375.38..375.88 rows=1 width=224) (actual time=0.021..0.021 rows=1 loops=2,311)

46. 0.000 46.220 ↓ 0.0 0 2,311

Nested Loop Left Join (cost=344.00..361.38 rows=1 width=88) (actual time=0.020..0.020 rows=0 loops=2,311)

47. 0.000 46.220 ↓ 0.0 0 2,311

Nested Loop Left Join (cost=258.00..273.30 rows=1 width=82) (actual time=0.020..0.020 rows=0 loops=2,311)

48. 0.000 46.220 ↓ 0.0 0 2,311

Nested Loop (cost=172.00..185.21 rows=1 width=37) (actual time=0.020..0.020 rows=0 loops=2,311)

49. 46.220 46.220 ↓ 0.0 0 2,311

Index Scan using idx_fiboguia_guicobrancaoriginal_idx on fiboguia guia_estorno_convenio (cost=86.00..94.21 rows=1 width=8) (actual time=0.020..0.020 rows=0 loops=2,311)

  • Index Cond: (guicobrancaoriginal = guiaprestador.id)
  • Filter: (guisituacaoguia = 'PosAuditoria'::text)
50. 0.000 0.000 ↓ 0.0 0

Index Scan using fiboguia_pkey on fiboguia guia_estorno (cost=86.00..90.50 rows=1 width=45) (never executed)

  • Index Cond: (id = guia_estorno_convenio.guiguiaassoc)
51. 0.000 0.000 ↓ 0.0 0

Index Scan using fiboguia_pkey on fiboguia ultimo_recurso_estorno_prestador (cost=86.00..87.59 rows=1 width=53) (never executed)

  • Index Cond: (guia_estorno.ultimo_recurso_id = id)
52. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_fiboguia_guiguiaassoc_idx on fiboguia ultimo_recurso_estorno_convenio (cost=86.00..87.59 rows=1 width=14) (never executed)

  • Index Cond: (guiguiaassoc = ultimo_recurso_estorno_prestador.id)
53.          

SubPlan (for WindowAgg)

54. 2.311 4.622 ↑ 1.0 1 2,311

Aggregate (cost=95.71..96.21 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=2,311)

55. 2.311 2.311 ↓ 0.0 0 2,311

Index Scan using idx_fiboguia_guicobrancaoriginal_idx on fiboguia guia_vinculada (cost=86.00..93.21 rows=2 width=19) (actual time=0.001..0.001 rows=0 loops=2,311)

  • Index Cond: (guicobrancaoriginal = guiaprestador.id)
56.          

SubPlan (for Result)

57. 0.100 0.200 ↑ 1.0 1 100

Aggregate (cost=95.71..96.21 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=100)

58. 0.100 0.100 ↓ 0.0 0 100

Index Scan using idx_fiboguia_guicobrancaoriginal_idx on fiboguia guia_vinculada_1 (cost=86.00..93.21 rows=2 width=19) (actual time=0.001..0.001 rows=0 loops=100)

  • Index Cond: (guicobrancaoriginal = guiaprestador.id)
59. 0.100 0.200 ↑ 1.0 1 100

Aggregate (cost=95.21..95.71 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=100)

60. 0.100 0.100 ↓ 0.0 0 100

Index Scan using idx_fiboguia_guicobrancaoriginal_idx on fiboguia pagrecurso (cost=86.00..94.21 rows=1 width=6) (actual time=0.001..0.001 rows=0 loops=100)

  • Index Cond: (guicobrancaoriginal = guiaprestador.id)
  • Filter: (guisituacaoguia = 'PosAuditoria'::text)
Planning time : 2,660.730 ms
Execution time : 13,081.981 ms