explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tGqi

Settings
# exclusive inclusive rows x rows loops node
1. 0.016 1,410.026 ↑ 10,108.0 1 1

Sort (cost=148,883.44..148,908.71 rows=10,108 width=549) (actual time=1,410.026..1,410.026 rows=1 loops=1)

  • Sort Key: se.nome, l.cod
  • Sort Method: quicksort Memory: 25kB
2. 0.045 1,410.010 ↑ 10,108.0 1 1

Hash Left Join (cost=146,616.44..148,211.10 rows=10,108 width=549) (actual time=1,410.000..1,410.010 rows=1 loops=1)

  • Hash Cond: (fb.id = contaatends.id_boletimfisio)
3. 6.546 1,376.770 ↑ 10,108.0 1 1

Hash Right Join (cost=142,180.57..143,737.00 rows=10,108 width=545) (actual time=1,376.760..1,376.770 rows=1 loops=1)

  • Hash Cond: (atend.id_prescricaofisio = presc.id)
4. 84.224 101.549 ↓ 1.1 67,180 1

HashAggregate (cost=3,441.07..4,070.10 rows=62,903 width=12) (actual time=76.649..101.549 rows=67,180 loops=1)

  • Group Key: atend.id_prescricaofisio
5. 17.325 17.325 ↑ 1.0 121,005 1

Seq Scan on fisioatendimentofisio atend (cost=0.00..2,836.05 rows=121,005 width=12) (actual time=0.005..17.325 rows=121,005 loops=1)

6. 0.006 1,268.675 ↑ 10,108.0 1 1

Hash (cost=138,613.14..138,613.14 rows=10,108 width=537) (actual time=1,268.675..1,268.675 rows=1 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 129kB
7. 0.019 1,268.669 ↑ 10,108.0 1 1

Hash Left Join (cost=20,163.55..138,613.14 rows=10,108 width=537) (actual time=1,268.658..1,268.669 rows=1 loops=1)

  • Hash Cond: (presc.id_tipofisio_medico = tpmedico.id)
8. 0.017 1,268.640 ↑ 10,108.0 1 1

Hash Left Join (cost=20,162.48..138,473.10 rows=10,108 width=411) (actual time=1,268.629..1,268.640 rows=1 loops=1)

  • Hash Cond: (presc.id_tipofisio = tp.id)
9. 0.003 1,268.613 ↑ 10,108.0 1 1

Nested Loop Left Join (cost=20,161.41..138,333.05 rows=10,108 width=285) (actual time=1,268.603..1,268.613 rows=1 loops=1)

10. 0.008 1,268.602 ↑ 10,108.0 1 1

Nested Loop Left Join (cost=20,160.99..132,945.66 rows=10,108 width=266) (actual time=1,268.593..1,268.602 rows=1 loops=1)

11. 0.042 1,268.580 ↑ 10,108.0 1 1

Hash Left Join (cost=20,160.57..128,310.07 rows=10,108 width=260) (actual time=1,268.571..1,268.580 rows=1 loops=1)

  • Hash Cond: (q.id_setor = se.id)
12. 0.033 1,268.386 ↑ 10,108.0 1 1

Hash Left Join (cost=20,149.36..128,159.87 rows=10,108 width=236) (actual time=1,268.377..1,268.386 rows=1 loops=1)

  • Hash Cond: (presc.id_medico_solicitante = m.id)
13. 0.030 1,225.121 ↑ 10,108.0 1 1

Hash Left Join (cost=15,924.79..123,796.62 rows=10,108 width=217) (actual time=1,225.112..1,225.121 rows=1 loops=1)

  • Hash Cond: (b.id_conv = co.id)
14. 2.864 1,225.056 ↑ 10,108.0 1 1

Hash Left Join (cost=15,922.82..123,655.67 rows=10,108 width=83) (actual time=1,225.048..1,225.056 rows=1 loops=1)

  • Hash Cond: (presc.id_prescricaomed = prem.id)
15. 0.019 1,054.557 ↑ 10,108.0 1 1

Hash Left Join (cost=4,421.51..112,042.88 rows=10,108 width=83) (actual time=1,054.550..1,054.557 rows=1 loops=1)

  • Hash Cond: (bi.id_leito = l.id)
16. 16.182 1,054.370 ↑ 10,108.0 1 1

Merge Left Join (cost=4,409.42..111,891.80 rows=10,108 width=78) (actual time=1,054.363..1,054.370 rows=1 loops=1)

  • Merge Cond: (b.id = bi.id_bol)
  • Join Filter: (bi.seq = (SubPlan 1))
17. 125.056 939.435 ↑ 10,108.0 1 1

Merge Join (cost=4,408.69..79,210.51 rows=10,108 width=74) (actual time=939.431..939.435 rows=1 loops=1)

  • Merge Cond: (b.id = fb.id_boletim)
18. 803.639 803.639 ↓ 1.0 1,058,947 1

Index Scan using hspbol_cluster_id on hspbol b (cost=0.43..72,540.48 rows=1,058,945 width=18) (actual time=0.027..803.639 rows=1,058,947 loops=1)

19. 0.011 10.740 ↑ 10,108.0 1 1

Sort (cost=3,871.06..3,896.33 rows=10,108 width=60) (actual time=10.739..10.740 rows=1 loops=1)

  • Sort Key: fb.id_boletim
  • Sort Method: quicksort Memory: 25kB
20. 0.068 10.729 ↑ 10,108.0 1 1

Hash Join (cost=1,068.30..3,198.71 rows=10,108 width=60) (actual time=10.728..10.729 rows=1 loops=1)

  • Hash Cond: (presc.id_boletimfisio = fb.id)
21. 0.011 3.318 ↑ 10,108.0 1 1

Bitmap Heap Scan on fisioprescricaofisio presc (cost=642.07..2,633.50 rows=10,108 width=52) (actual time=3.318..3.318 rows=1 loops=1)

  • Recheck Cond: (('2019-06-05'::date >= date(dt_inicio)) AND ('2019-06-05'::date <= date(dt_fim)) AND (inativa = 0))
  • Heap Blocks: exact=1
22. 3.307 3.307 ↑ 3,369.3 3 1

Bitmap Index Scan on idx_fisioprescricaofisio (cost=0.00..639.54 rows=10,108 width=0) (actual time=3.307..3.307 rows=3 loops=1)

  • Index Cond: (('2019-06-05'::date >= date(dt_inicio)) AND ('2019-06-05'::date <= date(dt_fim)))
23. 3.869 7.343 ↓ 1.0 12,901 1

Hash (cost=264.99..264.99 rows=12,899 width=12) (actual time=7.343..7.343 rows=12,901 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 633kB
24. 3.474 3.474 ↓ 1.0 12,901 1

Seq Scan on fisioboletim fb (cost=0.00..264.99 rows=12,899 width=12) (actual time=0.009..3.474 rows=12,901 loops=1)

25. 98.732 98.732 ↓ 1.0 144,395 1

Index Scan using hspbol_int_bk on hspbol_int bi (cost=0.42..14,545.20 rows=144,182 width=12) (actual time=0.029..98.732 rows=144,395 loops=1)

  • Index Cond: (tipo = '0'::numeric)
26.          

SubPlan (forMerge Left Join)

27. 0.008 0.021 ↑ 1.0 1 1

Aggregate (cost=12.88..12.89 rows=1 width=4) (actual time=0.021..0.021 rows=1 loops=1)

28. 0.013 0.013 ↑ 3.0 1 1

Index Scan using hspbol_int_uk_dt_baixa on hspbol_int (cost=0.42..12.87 rows=3 width=4) (actual time=0.012..0.013 rows=1 loops=1)

  • Index Cond: (id_bol = b.id)
29. 0.031 0.168 ↑ 1.0 178 1

Hash (cost=9.87..9.87 rows=178 width=13) (actual time=0.168..0.168 rows=178 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 17kB
30. 0.076 0.137 ↑ 1.0 178 1

Hash Left Join (cost=2.64..9.87 rows=178 width=13) (actual time=0.049..0.137 rows=178 loops=1)

  • Hash Cond: (l.id_quarto = q.id)
31. 0.027 0.027 ↑ 1.0 178 1

Seq Scan on tableito l (cost=0.00..4.78 rows=178 width=13) (actual time=0.007..0.027 rows=178 loops=1)

32. 0.014 0.034 ↑ 1.0 73 1

Hash (cost=1.73..1.73 rows=73 width=8) (actual time=0.034..0.034 rows=73 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
33. 0.020 0.020 ↑ 1.0 73 1

Seq Scan on tabquarto q (cost=0.00..1.73 rows=73 width=8) (actual time=0.005..0.020 rows=73 loops=1)

34. 102.916 167.635 ↓ 1.0 350,551 1

Hash (cost=7,119.47..7,119.47 rows=350,547 width=4) (actual time=167.635..167.635 rows=350,551 loops=1)

  • Buckets: 524288 Batches: 1 Memory Usage: 16421kB
35. 64.719 64.719 ↓ 1.0 350,551 1

Seq Scan on hsppresc prem (cost=0.00..7,119.47 rows=350,547 width=4) (actual time=0.022..64.719 rows=350,551 loops=1)

36. 0.012 0.035 ↑ 1.0 43 1

Hash (cost=1.43..1.43 rows=43 width=142) (actual time=0.035..0.035 rows=43 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
37. 0.023 0.023 ↑ 1.0 43 1

Seq Scan on tabconv co (cost=0.00..1.43 rows=43 width=142) (actual time=0.015..0.023 rows=43 loops=1)

38. 1.197 43.232 ↑ 1.0 3,471 1

Hash (cost=4,181.19..4,181.19 rows=3,471 width=27) (actual time=43.232..43.232 rows=3,471 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 226kB
39. 18.312 42.035 ↑ 1.0 3,471 1

Hash Right Join (cost=134.10..4,181.19 rows=3,471 width=27) (actual time=1.534..42.035 rows=3,471 loops=1)

  • Hash Cond: (pm.id = m.id_pes)
40. 22.230 22.230 ↑ 1.0 137,046 1

Seq Scan on tabpes pm (cost=0.00..3,498.46 rows=137,046 width=27) (actual time=0.006..22.230 rows=137,046 loops=1)

41. 0.698 1.493 ↑ 1.0 3,471 1

Hash (cost=90.71..90.71 rows=3,471 width=8) (actual time=1.493..1.493 rows=3,471 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 168kB
42. 0.795 0.795 ↑ 1.0 3,471 1

Seq Scan on tabmedico m (cost=0.00..90.71 rows=3,471 width=8) (actual time=0.008..0.795 rows=3,471 loops=1)

43. 0.072 0.152 ↑ 1.0 276 1

Hash (cost=7.76..7.76 rows=276 width=28) (actual time=0.152..0.152 rows=276 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
44. 0.080 0.080 ↑ 1.0 276 1

Seq Scan on tabset se (cost=0.00..7.76 rows=276 width=28) (actual time=0.014..0.080 rows=276 loops=1)

45. 0.014 0.014 ↑ 1.0 1 1

Index Scan using hsppront_cluster_id on hsppront pr (cost=0.42..0.45 rows=1 width=14) (actual time=0.014..0.014 rows=1 loops=1)

  • Index Cond: (b.id_pront = id)
46. 0.008 0.008 ↑ 1.0 1 1

Index Scan using tabpes_cluster_id on tabpes pp (cost=0.42..0.52 rows=1 width=27) (actual time=0.007..0.008 rows=1 loops=1)

  • Index Cond: (pr.id_pes = id)
47. 0.005 0.010 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=130) (actual time=0.010..0.010 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
48. 0.005 0.005 ↑ 1.0 3 1

Seq Scan on fisiotipofisio tp (cost=0.00..1.03 rows=3 width=130) (actual time=0.004..0.005 rows=3 loops=1)

49. 0.007 0.010 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=130) (actual time=0.010..0.010 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
50. 0.003 0.003 ↑ 1.0 3 1

Seq Scan on fisiotipofisio tpmedico (cost=0.00..1.03 rows=3 width=130) (actual time=0.002..0.003 rows=3 loops=1)

51. 0.002 33.195 ↓ 0.0 0 1

Hash (cost=4,435.39..4,435.39 rows=39 width=12) (actual time=33.195..33.195 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
52. 0.001 33.193 ↓ 0.0 0 1

Subquery Scan on contaatends (cost=4,434.61..4,435.39 rows=39 width=12) (actual time=33.193..33.193 rows=0 loops=1)

53. 0.004 33.192 ↓ 0.0 0 1

HashAggregate (cost=4,434.61..4,435.00 rows=39 width=8) (actual time=33.192..33.192 rows=0 loops=1)

  • Group Key: presc_1.id_boletimfisio
54. 18.010 33.188 ↓ 0.0 0 1

Hash Join (cost=1,135.71..4,431.58 rows=605 width=8) (actual time=33.188..33.188 rows=0 loops=1)

  • Hash Cond: (atend_1.id_prescricaofisio = presc_1.id)
55. 15.143 15.143 ↑ 1.0 121,005 1

Seq Scan on fisioatendimentofisio atend_1 (cost=0.00..2,836.05 rows=121,005 width=8) (actual time=0.014..15.143 rows=121,005 loops=1)

56. 0.007 0.035 ↑ 254.5 2 1

Hash (cost=1,129.35..1,129.35 rows=509 width=8) (actual time=0.035..0.035 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
57. 0.010 0.028 ↑ 254.5 2 1

Bitmap Heap Scan on fisioprescricaofisio presc_1 (cost=12.24..1,129.35 rows=509 width=8) (actual time=0.028..0.028 rows=2 loops=1)

  • Recheck Cond: (date(dt_inicio) = '2019-06-05'::date)
  • Heap Blocks: exact=1
58. 0.018 0.018 ↑ 101.8 5 1

Bitmap Index Scan on idx_fisioprescricaofisio_dts (cost=0.00..12.11 rows=509 width=0) (actual time=0.018..0.018 rows=5 loops=1)

  • Index Cond: (date(dt_inicio) = '2019-06-05'::date)
Planning time : 7.067 ms
Execution time : 1,410.820 ms