explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KKNy

Settings
# exclusive inclusive rows x rows loops node
1. 0.053 732.034 ↓ 52.0 52 1

Sort (cost=7,478.43..7,478.44 rows=1 width=228) (actual time=732.028..732.034 rows=52 loops=1)

  • Sort Key: p.ordem
  • Sort Method: quicksort Memory: 32kB
2.          

Initplan (for Sort)

3. 0.003 0.016 ↑ 1.0 1 1

Result (cost=0.32..0.33 rows=1 width=4) (actual time=0.016..0.016 rows=1 loops=1)

4.          

Initplan (for Result)

5. 0.002 0.013 ↑ 1.0 1 1

Limit (cost=0.29..0.32 rows=1 width=4) (actual time=0.012..0.013 rows=1 loops=1)

6. 0.011 0.011 ↑ 16,551.0 1 1

Index Only Scan Backward using pk_deputado on deputado deputado_1 (cost=0.29..489.93 rows=16,551 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: (idlegislatura IS NOT NULL)
  • Heap Fetches: 0
7. 0.070 731.965 ↓ 52.0 52 1

Nested Loop Left Join (cost=3,683.12..7,478.09 rows=1 width=228) (actual time=164.067..731.965 rows=52 loops=1)

  • Join Filter: (ip.cd_itempauta = ne.cd_itempauta)
8. 0.078 731.895 ↓ 52.0 52 1

Nested Loop Left Join (cost=3,683.12..7,441.09 rows=1 width=188) (actual time=164.063..731.895 rows=52 loops=1)

  • Join Filter: (ip.cd_itempauta = o.cd_itempauta)
9. 0.143 731.817 ↓ 52.0 52 1

Nested Loop (cost=3,683.12..7,417.37 rows=1 width=84) (actual time=164.059..731.817 rows=52 loops=1)

10. 1.931 730.724 ↓ 475.0 475 1

Nested Loop (cost=3,682.83..7,416.96 rows=1 width=88) (actual time=27.502..730.724 rows=475 loops=1)

  • Join Filter: (p.idevento = e.idevento)
11. 2.898 725.971 ↓ 2,822.0 2,822 1

Nested Loop (cost=3,682.54..7,413.61 rows=1 width=88) (actual time=24.133..725.971 rows=2,822 loops=1)

  • Join Filter: ((ip.idevento = p.idevento) AND (ip.idproposicao = p.idproposicao))
  • Rows Removed by Join Filter: 4941
12. 344.962 717.313 ↓ 2,880.0 2,880 1

Nested Loop (cost=3,682.26..7,413.26 rows=1 width=24) (actual time=24.104..717.313 rows=2,880 loops=1)

  • Join Filter: (t.idproposicao = ip.idproposicao)
  • Rows Removed by Join Filter: 4892088
13. 14.399 44.505 ↓ 1,623.0 1,623 1

Hash Join (cost=3,682.26..7,328.40 rows=1 width=12) (actual time=24.045..44.505 rows=1,623 loops=1)

  • Hash Cond: ((t.idproposicao = tramitacao.idproposicao) AND (t.datahora = (max(tramitacao.datahora))) AND (t.sequencia = (max(tramitacao.sequencia))))
14. 6.086 6.086 ↑ 1.0 52,092 1

Seq Scan on tramitacao t (cost=0.00..3,235.92 rows=52,092 width=20) (actual time=0.010..6.086 rows=52,092 loops=1)

15. 0.333 24.020 ↓ 1.1 1,646 1

Hash (cost=3,656.29..3,656.29 rows=1,484 width=16) (actual time=24.020..24.020 rows=1,646 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 94kB
16. 17.489 23.687 ↓ 1.1 1,646 1

HashAggregate (cost=3,626.61..3,641.45 rows=1,484 width=16) (actual time=23.369..23.687 rows=1,646 loops=1)

  • Group Key: tramitacao.idproposicao
17. 6.198 6.198 ↑ 1.0 52,092 1

Seq Scan on tramitacao (cost=0.00..3,235.92 rows=52,092 width=16) (actual time=0.001..6.198 rows=52,092 loops=1)

18. 327.846 327.846 ↑ 1.0 3,016 1,623

Seq Scan on itempauta ip (cost=0.00..47.16 rows=3,016 width=12) (actual time=0.001..0.202 rows=3,016 loops=1,623)

19. 5.760 5.760 ↓ 1.5 3 2,880

Index Scan using pauta_idproposicao_idx on pauta p (cost=0.28..0.32 rows=2 width=72) (actual time=0.001..0.002 rows=3 loops=2,880)

  • Index Cond: (idproposicao = t.idproposicao)
20. 2.822 2.822 ↓ 0.0 0 2,822

Index Scan using pk_evento on evento e (cost=0.29..3.33 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=2,822)

  • Index Cond: (idevento = ip.idevento)
  • Filter: ((datahorainicio >= '2019-11-05 00:00:00-03'::timestamp with time zone) AND (datahorainicio <= '2019-11-12 00:00:00-03'::timestamp with time zone))
  • Rows Removed by Filter: 1
21. 0.950 0.950 ↓ 0.0 0 475

Index Scan using pk_deputado on deputado (cost=0.29..0.35 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=475)

  • Index Cond: ((idlegislatura = $1) AND (iddeputado = t.idrelator))
  • Filter: (siglapartido = 'PSL'::text)
  • Rows Removed by Filter: 1
22. 0.000 0.000 ↓ 0.0 0 52

Seq Scan on orientacao o (cost=0.00..16.10 rows=610 width=104) (actual time=0.000..0.000 rows=0 loops=52)

23. 0.000 0.000 ↓ 0.0 0 52

Seq Scan on notaexplicativa ne (cost=0.00..22.00 rows=1,200 width=40) (actual time=0.000..0.000 rows=0 loops=52)