explain.depesz.com

A tool for finding a real cause for slow queries.

Result: vS1

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 3.229 1,295.443 ↓ 7.9 3,977 1

Merge Left Join (cost=112,687.26..112,693.75 rows=504 width=104) (actual time=1,290.664..1,295.443 rows=3,977 loops=1)

  • Merge Cond: ((guiaconvenio.id = guiaprestador.guiguiaassoc) AND ((COALESCE(agrupadorconvenio.id, (-1)::bigint)) = (COALESCE(agrupadorprestador.id, (-1)::bigint))))
2. 3.363 263.655 ↓ 7.9 3,977 1

Sort (cost=43,242.55..43,243.81 rows=504 width=48) (actual time=262.774..263.655 rows=3,977 loops=1)

  • Sort Key: guiaconvenio.id, (COALESCE(agrupadorconvenio.id, (-1)::bigint))
  • Sort Method: quicksort Memory: 344kB
3. 36.793 260.292 ↓ 7.9 3,977 1

HashAggregate (cost=43,209.85..43,214.89 rows=504 width=22) (actual time=258.943..260.292 rows=3,977 loops=1)

4. 26.367 223.499 ↓ 104.7 52,746 1

Hash Left Join (cost=6,965.22..43,206.07 rows=504 width=22) (actual time=65.278..223.499 rows=52,746 loops=1)

  • Hash Cond: (produtoconvenio.prodcc = agrupadorconvenio.id)
5. 48.093 197.110 ↓ 104.7 52,746 1

Hash Join (cost=6,963.57..43,197.53 rows=504 width=22) (actual time=65.238..197.110 rows=52,746 loops=1)

  • Hash Cond: ((produtoconvenio.prodguia = guiaconvenio.id) AND (competenciaconvenio.id = guiaconvenio.guicompetencia))
6. 55.324 93.674 ↓ 4.6 106,711 1

Nested Loop (cost=538.45..36,245.98 rows=23,311 width=38) (actual time=9.854..93.674 rows=106,711 loops=1)

7. 0.057 0.057 ↑ 1.0 1 1

Index Scan using fibocompetencia_pkey on fibocompetencia competenciaconvenio (cost=0.00..75.83 rows=1 width=8) (actual time=0.046..0.057 rows=1 loops=1)

  • Filter: (((comp_convenio)::text = 'Ipasgo'::text) AND ((comp_desc)::text = '01-2011'::text))
8. 28.883 38.293 ↓ 3.7 106,711 1

Bitmap Heap Scan on fiboproduto produtoconvenio (cost=538.45..35,812.00 rows=28,652 width=30) (actual time=9.797..38.293 rows=106,711 loops=1)

  • Recheck Cond: (prodcomp = competenciaconvenio.id)
9. 9.410 9.410 ↓ 3.7 106,711 1

Bitmap Index Scan on idx_fiboproduto_prodcomp_idx (cost=0.00..531.29 rows=28,652 width=0) (actual time=9.410..9.410 rows=106,711 loops=1)

  • Index Cond: (prodcomp = competenciaconvenio.id)
10. 19.074 55.343 ↓ 1.0 55,276 1

Hash (cost=5,603.84..5,603.84 rows=54,752 width=16) (actual time=55.343..55.343 rows=55,276 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 1944kB
11. 36.269 36.269 ↓ 1.0 55,287 1

Seq Scan on fiboguia guiaconvenio (cost=0.00..5,603.84 rows=54,752 width=16) (actual time=0.033..36.269 rows=55,287 loops=1)

  • Filter: ((guiorigem)::text = 'CONVENIO'::text)
12. 0.006 0.022 ↓ 1.2 35 1

Hash (cost=1.29..1.29 rows=29 width=8) (actual time=0.022..0.022 rows=35 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
13. 0.016 0.016 ↓ 1.2 35 1

Seq Scan on fibocentrodecusto agrupadorconvenio (cost=0.00..1.29 rows=29 width=8) (actual time=0.004..0.016 rows=35 loops=1)

14. 3.215 1,028.559 ↓ 10.8 3,861 1

Sort (cost=69,444.71..69,445.60 rows=356 width=56) (actual time=1,027.883..1,028.559 rows=3,861 loops=1)

  • Sort Key: guiaprestador.guiguiaassoc, (COALESCE(agrupadorprestador.id, (-1)::bigint))
  • Sort Method: quicksort Memory: 336kB
15. 36.697 1,025.344 ↓ 10.8 3,861 1

HashAggregate (cost=69,422.50..69,426.06 rows=356 width=30) (actual time=1,023.704..1,025.344 rows=3,861 loops=1)

16. 26.397 988.647 ↓ 147.6 52,532 1

Hash Left Join (cost=11,236.19..69,419.83 rows=356 width=30) (actual time=710.055..988.647 rows=52,532 loops=1)

  • Hash Cond: (produtoprestador.prodcc = agrupadorprestador.id)
17. 471.907 962.227 ↓ 147.6 52,532 1

Hash Join (cost=11,234.54..69,413.31 rows=356 width=30) (actual time=710.012..962.227 rows=52,532 loops=1)

  • Hash Cond: ((produtoprestador.prodguia = guiaprestador.id) AND (produtoprestador.prodcomp = guiaprestador.guicompetencia))
18. 402.812 402.812 ↑ 1.0 1,213,051 1

Seq Scan on fiboproduto produtoprestador (cost=0.00..49,003.12 rows=1,222,946 width=30) (actual time=0.004..402.812 rows=1,213,051 loops=1)

  • Filter: prodassociado
19. 1.435 87.508 ↓ 4.9 3,638 1

Hash (cost=11,223.42..11,223.42 rows=741 width=32) (actual time=87.508..87.508 rows=3,638 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 185kB
20. 10.232 86.073 ↓ 4.9 3,638 1

Hash Join (cost=4,868.13..11,223.42 rows=741 width=32) (actual time=38.921..86.073 rows=3,638 loops=1)

  • Hash Cond: (guiaprestador.guiguiaassoc = guiaconvenioassociada.id)
21. 20.417 70.956 ↓ 2.8 33,120 1

Hash Join (cost=2.89..6,219.40 rows=11,678 width=32) (actual time=0.063..70.956 rows=33,120 loops=1)

  • Hash Cond: (guiaprestador.guicompetencia = competenciaprestador.id)
22. 50.517 50.517 ↑ 1.0 56,705 1

Seq Scan on fiboguia guiaprestador (cost=0.00..5,884.40 rows=57,420 width=24) (actual time=0.005..50.517 rows=56,705 loops=1)

  • Filter: (((discriminador)::text <> 'RECURSO'::text) AND ((guiorigem)::text = 'HOSPITAL'::text))
23. 0.003 0.022 ↑ 1.1 11 1

Hash (cost=2.74..2.74 rows=12 width=8) (actual time=0.022..0.022 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
24. 0.019 0.019 ↑ 1.1 11 1

Seq Scan on fibocompetencia competenciaprestador (cost=0.00..2.74 rows=12 width=8) (actual time=0.005..0.019 rows=11 loops=1)

  • Filter: ((comp_convenio)::text = 'Ipasgo'::text)
25. 1.997 4.885 ↓ 1.0 7,378 1

Hash (cost=4,773.45..4,773.45 rows=7,343 width=8) (actual time=4.885..4.885 rows=7,378 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 202kB
26. 2.263 2.888 ↓ 1.0 7,378 1

Bitmap Heap Scan on fiboguia guiaconvenioassociada (cost=361.20..4,773.45 rows=7,343 width=8) (actual time=0.661..2.888 rows=7,378 loops=1)

  • Recheck Cond: (guicompetencia = 29720576)
27. 0.625 0.625 ↓ 1.0 7,378 1

Bitmap Index Scan on idx_fiboguia_guicompetencia_idx (cost=0.00..359.37 rows=7,343 width=0) (actual time=0.625..0.625 rows=7,378 loops=1)

  • Index Cond: (guicompetencia = 29720576)
28. 0.011 0.023 ↓ 1.2 35 1

Hash (cost=1.29..1.29 rows=29 width=8) (actual time=0.023..0.023 rows=35 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
29. 0.012 0.012 ↓ 1.2 35 1

Seq Scan on fibocentrodecusto agrupadorprestador (cost=0.00..1.29 rows=29 width=8) (actual time=0.004..0.012 rows=35 loops=1)