explain.depesz.com

PostgreSQL's explain analyze made readable

Result: OHqZ

Settings
# exclusive inclusive rows x rows loops node
1. 2,568.162 11,163.963 ↑ 1.3 206,597 1

Hash Join (cost=2,479,582.57..3,012,162.48 rows=268,479 width=658) (actual time=6,732.255..11,163.963 rows=206,597 loops=1)

  • Hash Cond: (medicaoindicador.unidadenegocioid = unidadenegocio.id)
2.          

CTE ultimamedicao

3. 401.315 8,253.245 ↑ 1.3 206,597 1

Unique (cost=2,425,166.78..2,470,070.24 rows=268,272 width=51) (actual time=6,727.391..8,253.245 rows=206,597 loops=1)

4. 5,549.399 7,851.930 ↑ 1.0 5,983,804 1

Sort (cost=2,425,166.78..2,440,134.60 rows=5,987,128 width=51) (actual time=6,727.389..7,851.930 rows=5,983,804 loops=1)

  • Sort Key: medicaoindicador_1.indicadorid, medicaoindicador_1.unidadenegocioid, medicaoindicador_1.data DESC
  • Sort Method: external merge Disk: 311144kB
5. 242.646 2,302.531 ↑ 1.0 5,983,804 1

Append (cost=0.42..1,341,929.77 rows=5,987,128 width=51) (actual time=0.347..2,302.531 rows=5,983,804 loops=1)

  • Subplans Removed: 10
6. 1,548.737 1,548.737 ↑ 1.0 4,080,275 1

Seq Scan on medicaoindicador_201908 medicaoindicador_1 (cost=0.00..178,777.93 rows=4,083,403 width=51) (actual time=0.346..1,548.737 rows=4,080,275 loops=1)

  • Filter: (data >= (CURRENT_DATE - '1 mon'::interval))
  • Rows Removed by Filter: 1909785
7. 510.594 510.594 ↑ 1.0 1,903,322 1

Seq Scan on medicaoindicador_201909 medicaoindicador_1_1 (cost=0.00..56,811.97 rows=1,903,484 width=51) (actual time=0.744..510.594 rows=1,903,322 loops=1)

  • Filter: (data >= (CURRENT_DATE - '1 mon'::interval))
8. 0.216 0.216 ↑ 1.0 3 1

Seq Scan on medicaoindicador_202006 medicaoindicador_1_2 (cost=0.00..1.05 rows=3 width=51) (actual time=0.215..0.216 rows=3 loops=1)

  • Filter: (data >= (CURRENT_DATE - '1 mon'::interval))
9. 0.338 0.338 ↑ 1.0 204 1

Seq Scan on medicaoindicador_202007 medicaoindicador_1_3 (cost=0.00..6.57 rows=204 width=51) (actual time=0.188..0.338 rows=204 loops=1)

  • Filter: (data >= (CURRENT_DATE - '1 mon'::interval))
10.          

CTE medicoeseerros

11. 16.104 8,310.126 ↑ 1.3 206,597 1

Append (cost=0.00..9,414.51 rows=268,479 width=80) (actual time=6,727.393..8,310.126 rows=206,597 loops=1)

12. 8,294.019 8,294.019 ↑ 1.3 206,597 1

CTE Scan on ultimamedicao (cost=0.00..5,365.44 rows=268,272 width=66) (actual time=6,727.392..8,294.019 rows=206,597 loops=1)

13. 0.000 0.003 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=0.00..23.95 rows=207 width=80) (actual time=0.003..0.003 rows=0 loops=1)

14. 0.003 0.003 ↓ 0.0 0 1

Seq Scan on erromedicaoindicador (cost=0.00..21.37 rows=207 width=76) (actual time=0.003..0.003 rows=0 loops=1)

  • Filter: (datahora >= (CURRENT_DATE - '7 days'::interval))
15. 47.752 8,594.772 ↑ 1.3 206,597 1

Hash Join (cost=53.39..9,063.48 rows=268,479 width=238) (actual time=6,730.368..8,594.772 rows=206,597 loops=1)

  • Hash Cond: (indicador.classificacaoinvestimentoid = classificacaoinvestimento.id)
16. 43.557 8,546.984 ↑ 1.3 206,597 1

Hash Join (cost=48.90..8,327.32 rows=268,479 width=215) (actual time=6,730.321..8,546.984 rows=206,597 loops=1)

  • Hash Cond: (indicador.classificacaoramoatividadeid = classificacaoramoatividade.id)
17. 43.151 8,503.396 ↑ 1.3 206,597 1

Hash Join (cost=44.40..7,591.15 rows=268,479 width=192) (actual time=6,730.277..8,503.396 rows=206,597 loops=1)

  • Hash Cond: (indicador.classificacaogestaoid = classificacaogestao.id)
18. 43.325 8,460.214 ↑ 1.3 206,597 1

Hash Join (cost=39.90..6,854.98 rows=268,479 width=169) (actual time=6,730.234..8,460.214 rows=206,597 loops=1)

  • Hash Cond: (indicador.classificacaodepartamentoid = classificacaodepartamento.id)
19. 62.118 8,416.856 ↑ 1.3 206,597 1

Hash Join (cost=35.40..6,118.82 rows=268,479 width=146) (actual time=6,730.190..8,416.856 rows=206,597 loops=1)

  • Hash Cond: (medicaoindicador.indicadorid = indicador.id)
20. 8,351.959 8,351.959 ↑ 1.3 206,597 1

CTE Scan on medicoeseerros medicaoindicador (cost=0.00..5,369.58 rows=268,479 width=64) (actual time=6,727.395..8,351.959 rows=206,597 loops=1)

21. 0.071 2.779 ↑ 1.0 329 1

Hash (cost=31.29..31.29 rows=329 width=90) (actual time=2.779..2.779 rows=329 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 51kB
22. 2.708 2.708 ↑ 1.0 329 1

Seq Scan on indicador (cost=0.00..31.29 rows=329 width=90) (actual time=1.218..2.708 rows=329 loops=1)

23. 0.020 0.033 ↑ 1.0 111 1

Hash (cost=3.11..3.11 rows=111 width=31) (actual time=0.033..0.033 rows=111 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
24. 0.013 0.013 ↑ 1.0 111 1

Seq Scan on classificacaoindicador classificacaodepartamento (cost=0.00..3.11 rows=111 width=31) (actual time=0.002..0.013 rows=111 loops=1)

25. 0.017 0.031 ↑ 1.0 111 1

Hash (cost=3.11..3.11 rows=111 width=31) (actual time=0.031..0.031 rows=111 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
26. 0.014 0.014 ↑ 1.0 111 1

Seq Scan on classificacaoindicador classificacaogestao (cost=0.00..3.11 rows=111 width=31) (actual time=0.002..0.014 rows=111 loops=1)

27. 0.017 0.031 ↑ 1.0 111 1

Hash (cost=3.11..3.11 rows=111 width=31) (actual time=0.031..0.031 rows=111 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
28. 0.014 0.014 ↑ 1.0 111 1

Seq Scan on classificacaoindicador classificacaoramoatividade (cost=0.00..3.11 rows=111 width=31) (actual time=0.002..0.014 rows=111 loops=1)

29. 0.020 0.036 ↑ 1.0 111 1

Hash (cost=3.11..3.11 rows=111 width=31) (actual time=0.036..0.036 rows=111 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
30. 0.016 0.016 ↑ 1.0 111 1

Seq Scan on classificacaoindicador classificacaoinvestimento (cost=0.00..3.11 rows=111 width=31) (actual time=0.003..0.016 rows=111 loops=1)

31. 0.170 1.029 ↑ 1.0 1,352 1

Hash (cost=27.52..27.52 rows=1,352 width=16) (actual time=1.029..1.029 rows=1,352 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 80kB
32. 0.859 0.859 ↑ 1.0 1,352 1

Seq Scan on unidadenegocio (cost=0.00..27.52 rows=1,352 width=16) (actual time=0.212..0.859 rows=1,352 loops=1)

Planning time : 25.135 ms
Execution time : 11,206.504 ms