explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RMck

Settings
# exclusive inclusive rows x rows loops node
1. 19,022.318 80,428.273 ↓ 15,373.0 15,373 1

GroupAggregate (cost=22,714.33..22,737.89 rows=1 width=64) (actual time=60,726.315..80,428.273 rows=15,373 loops=1)

  • Group Key: cadp.cadfamiliaid
2. 4,737.734 61,405.955 ↓ 8,551.4 8,055,458 1

Sort (cost=22,714.33..22,716.68 rows=942 width=68) (actual time=60,726.261..61,405.955 rows=8,055,458 loops=1)

  • Sort Key: cadp.cadfamiliaid
  • Sort Method: quicksort Memory: 871,365kB
3. 3,186.589 56,668.221 ↓ 8,551.4 8,055,458 1

Hash Left Join (cost=18,840.14..22,667.79 rows=942 width=68) (actual time=3,172.235..56,668.221 rows=8,055,458 loops=1)

  • Hash Cond: (fam.familiaid = ativ_familia.familiaid)
4. 2,016.306 53,481.246 ↓ 4,649.8 4,380,135 1

Hash Left Join (cost=18,819.03..22,615.61 rows=942 width=67) (actual time=3,171.840..53,481.246 rows=4,380,135 loops=1)

  • Hash Cond: (cadp.pessoaid = recep.pessoaid)
5. 807.222 51,452.964 ↓ 3,268.6 1,751,968 1

Nested Loop Left Join (cost=17,672.61..21,422.25 rows=536 width=67) (actual time=3,159.837..51,452.964 rows=1,751,968 loops=1)

6. 332.157 47,406.307 ↓ 2,699.5 647,887 1

Nested Loop Left Join (cost=17,672.19..18,591.57 rows=240 width=62) (actual time=3,159.819..47,406.307 rows=647,887 loops=1)

7. 95.246 46,039.498 ↓ 15,676.5 172,442 1

Nested Loop Left Join (cost=17,667.73..17,755.67 rows=11 width=56) (actual time=3,159.804..46,039.498 rows=172,442 loops=1)

8. 66.983 45,476.384 ↓ 14,177.8 155,956 1

Nested Loop Left Join (cost=17,667.44..17,751.75 rows=11 width=50) (actual time=3,159.800..45,476.384 rows=155,956 loops=1)

9. 44.413 3,306.978 ↓ 47,253.0 47,253 1

Nested Loop Left Join (cost=17,454.15..17,465.97 rows=1 width=34) (actual time=3,159.750..3,306.978 rows=47,253 loops=1)

  • Join Filter: (cadp.pessoaid = abord.pessoaid)
10. 81.474 3,262.565 ↓ 47,253.0 47,253 1

Group (cost=17,454.15..17,454.16 rows=1 width=14) (actual time=3,159.739..3,262.565 rows=47,253 loops=1)

  • Group Key: cadp.cadfamiliaid, cadp.pessoaid
11. 242.698 3,181.091 ↓ 193,365.0 193,365 1

Sort (cost=17,454.15..17,454.16 rows=1 width=14) (actual time=3,159.734..3,181.091 rows=193,365 loops=1)

  • Sort Key: cadp.cadfamiliaid, cadp.pessoaid
  • Sort Method: quicksort Memory: 15,208kB
12. 69.100 2,938.393 ↓ 193,365.0 193,365 1

Nested Loop (cost=11,289.93..17,454.14 rows=1 width=14) (actual time=27.950..2,938.393 rows=193,365 loops=1)

13. 123.719 1,709.091 ↓ 193,367.0 193,367 1

Nested Loop (cost=11,289.51..17,453.49 rows=1 width=67) (actual time=27.927..1,709.091 rows=193,367 loops=1)

  • Join Filter: (cad3.cadfamiliaid = cadp.cadfamiliaid)
14. 27.079 1,021.991 ↓ 43,337.0 43,337 1

Nested Loop (cost=11,289.09..17,451.81 rows=1 width=78) (actual time=27.894..1,021.991 rows=43,337 loops=1)

15. 37.649 734.890 ↓ 43,337.0 43,337 1

Nested Loop (cost=11,288.67..17,451.02 rows=1 width=65) (actual time=27.869..734.890 rows=43,337 loops=1)

16. 45.339 393.882 ↓ 43,337.0 43,337 1

Nested Loop (cost=11,288.24..17,449.78 rows=1 width=84) (actual time=27.843..393.882 rows=43,337 loops=1)

17. 0.000 45.002 ↓ 43,363.0 43,363 1

Gather (cost=11,287.82..17,448.12 rows=1 width=63) (actual time=27.800..45.002 rows=43,363 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
18. 7.815 172.137 ↓ 14,454.0 14,454 3 / 3

Nested Loop (cost=10,287.82..16,448.02 rows=1 width=63) (actual time=23.962..172.137 rows=14,454 loops=3)

19. 20.635 48.687 ↓ 14,454.0 14,454 3 / 3

Parallel Hash Join (cost=10,287.39..16,445.70 rows=1 width=42) (actual time=23.899..48.687 rows=14,454 loops=3)

  • Hash Cond: ((cad6.cadfamiliaid = cad8.cadfamiliaid) AND (cad6.cadpessoaid = cad8.cadpessoaid))
20. 9.555 12.039 ↑ 1.3 18,286 3 / 3

Parallel Bitmap Heap Scan on cadunicolinha06 cad6 (cost=1,524.29..7,561.83 rows=23,003 width=21) (actual time=7.546..12.039 rows=18,286 loops=3)

  • Recheck Cond: (cadunicoid = '18'::numeric)
  • Heap Blocks: exact=1
21. 2.484 2.484 ↑ 1.0 54,858 1 / 3

Bitmap Index Scan on pk_cadunicolinha06 (cost=0.00..1,510.48 rows=55,208 width=0) (actual time=7.452..7.452 rows=54,858 loops=1)

  • Index Cond: (cadunicoid = '18'::numeric)
22. 7.972 16.013 ↑ 1.2 14,454 3 / 3

Parallel Hash (cost=8,492.82..8,492.82 rows=18,019 width=21) (actual time=16.012..16.013 rows=14,454 loops=3)

  • Buckets: 65,536 Batches: 1 Memory Usage: 2,912kB
23. 6.058 8.041 ↑ 1.2 14,454 3 / 3

Parallel Bitmap Heap Scan on cadunicolinha08 cad8 (cost=1,195.58..8,492.82 rows=18,019 width=21) (actual time=3.279..8.041 rows=14,454 loops=3)

  • Recheck Cond: (cadunicoid = '18'::numeric)
  • Heap Blocks: exact=237
24. 1.983 1.983 ↓ 1.0 43,363 1 / 3

Bitmap Index Scan on pk_cadunicolinha08 (cost=0.00..1,184.77 rows=43,246 width=0) (actual time=5.949..5.949 rows=43,363 loops=1)

  • Index Cond: (cadunicoid = '18'::numeric)
25. 115.635 115.635 ↑ 1.0 1 43,363 / 3

Index Only Scan using pk_cadunicolinha04 on cadunicolinha04 cad4 (cost=0.42..2.32 rows=1 width=21) (actual time=0.008..0.008 rows=1 loops=43,363)

  • Index Cond: ((cadunicoid = '18'::numeric) AND (cadfamiliaid = cad6.cadfamiliaid) AND (cadpessoaid = cad6.cadpessoaid))
  • Heap Fetches: 43,363
26. 303.541 303.541 ↑ 1.0 1 43,363

Index Only Scan using pk_cadunicolinha05 on cadunicolinha05 cad5 (cost=0.42..1.66 rows=1 width=21) (actual time=0.007..0.007 rows=1 loops=43,363)

  • Index Cond: ((cadunicoid = '18'::numeric) AND (cadfamiliaid = cad4.cadfamiliaid) AND (cadpessoaid = cad4.cadpessoaid))
  • Heap Fetches: 43,337
27. 303.359 303.359 ↑ 1.0 1 43,337

Index Only Scan using pk_cadunicolinha07 on cadunicolinha07 cad7 (cost=0.42..1.23 rows=1 width=21) (actual time=0.007..0.007 rows=1 loops=43,337)

  • Index Cond: ((cadunicoid = '18'::numeric) AND (cadfamiliaid = cad4.cadfamiliaid) AND (cadpessoaid = cad4.cadpessoaid))
  • Heap Fetches: 43,337
28. 260.022 260.022 ↑ 1.0 1 43,337

Index Only Scan using pk_cadunicolinha03 on cadunicolinha03 cad3 (cost=0.42..0.79 rows=1 width=13) (actual time=0.006..0.006 rows=1 loops=43,337)

  • Index Cond: ((cadunicoid = '18'::numeric) AND (cadfamiliaid = cad4.cadfamiliaid))
  • Heap Fetches: 43,337
29. 563.381 563.381 ↑ 1.0 4 43,337

Index Scan using pk_cadunicopessoa on cadunicopessoa cadp (cost=0.42..1.63 rows=4 width=19) (actual time=0.009..0.013 rows=4 loops=43,337)

  • Index Cond: ((cadunicoid = '18'::numeric) AND (cadfamiliaid = cad4.cadfamiliaid))
30. 1,160.202 1,160.202 ↑ 1.0 1 193,367

Index Only Scan using pk_cadunicolinha02 on cadunicolinha02 cad2 (cost=0.42..0.65 rows=1 width=13) (actual time=0.006..0.006 rows=1 loops=193,367)

  • Index Cond: ((cadunicoid = '18'::numeric) AND (cadfamiliaid = cadp.cadfamiliaid))
  • Heap Fetches: 193,365
31. 0.000 0.000 ↓ 0.0 0 47,253

Seq Scan on abordagem abord (cost=0.00..10.80 rows=80 width=36) (actual time=0.000..0.000 rows=0 loops=47,253)

32. 5,956.119 42,102.423 ↑ 3.7 3 47,253

Hash Right Join (cost=213.29..285.66 rows=11 width=22) (actual time=0.883..0.891 rows=3 loops=47,253)

  • Hash Cond: (atendviol.atendimentoid = atend.atendimentoid)
33. 3,399.975 3,399.975 ↑ 1.0 1,772 15,111

Seq Scan on atendimentoviolencia atendviol (cost=0.00..65.72 rows=1,772 width=11) (actual time=0.001..0.225 rows=1,772 loops=15,111)

34. 94.506 32,746.329 ↑ 3.7 3 47,253

Hash (cost=213.15..213.15 rows=11 width=17) (actual time=0.693..0.693 rows=3 loops=47,253)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
35. 20,849.883 32,651.823 ↑ 3.7 3 47,253

Hash Right Join (cost=45.48..213.15 rows=11 width=17) (actual time=0.615..0.691 rows=3 loops=47,253)

  • Hash Cond: (enc.atendimentoid = atend.atendimentoid)
36. 11,423.916 11,423.916 ↑ 1.0 6,390 15,111

Seq Scan on atendimentoenc enc (cost=0.00..150.90 rows=6,390 width=11) (actual time=0.001..0.756 rows=6,390 loops=15,111)

37. 94.506 378.024 ↑ 3.7 3 47,253

Hash (cost=45.34..45.34 rows=11 width=12) (actual time=0.008..0.008 rows=3 loops=47,253)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
38. 283.518 283.518 ↑ 3.7 3 47,253

Index Scan using idx_atendimento4 on atendimento atend (cost=0.42..45.34 rows=11 width=12) (actual time=0.005..0.006 rows=3 loops=47,253)

  • Index Cond: (pessoaid = cadp.pessoaid)
39. 467.868 467.868 ↓ 0.0 0 155,956

Index Scan using idx_atendimentoespecialidade01 on atendimentoespecialidade atendespec (cost=0.29..0.34 rows=2 width=17) (actual time=0.003..0.003 rows=0 loops=155,956)

  • Index Cond: (atendimentoid = atend.atendimentoid)
40. 517.326 1,034.652 ↑ 7.3 3 172,442

Bitmap Heap Scan on atividadecolpessoa ativ_pessoa (cost=4.46..75.77 rows=22 width=12) (actual time=0.004..0.006 rows=3 loops=172,442)

  • Recheck Cond: (cadp.pessoaid = pessoaid)
  • Heap Blocks: exact=278,160
41. 517.326 517.326 ↑ 7.3 3 172,442

Bitmap Index Scan on idx_atividadecolpessoa01 (cost=0.00..4.46 rows=22 width=0) (actual time=0.003..0.003 rows=3 loops=172,442)

  • Index Cond: (pessoaid = cadp.pessoaid)
42. 3,239.435 3,239.435 ↓ 1.5 3 647,887

Index Scan using idx_familiapessoar3 on familiapessoa fam (cost=0.42..11.77 rows=2 width=11) (actual time=0.004..0.005 rows=3 loops=647,887)

  • Index Cond: (pessoaid = cadp.pessoaid)
43. 5.822 11.976 ↑ 2.0 15,293 1

Hash (cost=769.52..769.52 rows=30,152 width=12) (actual time=11.976..11.976 rows=15,293 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 934kB
44. 6.154 6.154 ↓ 1.0 30,156 1

Seq Scan on recepcao recep (cost=0.00..769.52 rows=30,152 width=12) (actual time=0.007..6.154 rows=30,156 loops=1)

45. 0.225 0.386 ↑ 1.0 716 1

Hash (cost=12.16..12.16 rows=716 width=11) (actual time=0.386..0.386 rows=716 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 40kB
46. 0.161 0.161 ↑ 1.0 716 1

Seq Scan on atividadecolfamilia ativ_familia (cost=0.00..12.16 rows=716 width=11) (actual time=0.009..0.161 rows=716 loops=1)

Planning time : 84.239 ms
Execution time : 80,508.626 ms