explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Hfbx

Settings
# exclusive inclusive rows x rows loops node
1. 0.025 170.716 ↑ 3.7 75 1

Sort (cost=229,565.40..229,566.09 rows=275 width=12) (actual time=170.710..170.716 rows=75 loops=1)

  • Sort Key: (count(selo.id_selo)) DESC
  • Sort Method: quicksort Memory: 28kB
2. 0.000 170.691 ↑ 3.7 75 1

Finalize GroupAggregate (cost=229,478.15..229,554.26 rows=275 width=12) (actual time=170.431..170.691 rows=75 loops=1)

  • Group Key: selo.id_cartorio
3. 9.588 176.284 ↑ 3.0 184 1

Gather Merge (cost=229,478.15..229,548.76 rows=550 width=12) (actual time=170.409..176.284 rows=184 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 0.109 166.696 ↑ 4.5 61 3 / 3

Partial GroupAggregate (cost=228,478.13..228,485.25 rows=275 width=12) (actual time=166.564..166.696 rows=61 loops=3)

  • Group Key: selo.id_cartorio
5. 0.208 166.587 ↑ 1.4 419 3 / 3

Sort (cost=228,478.13..228,479.59 rows=583 width=8) (actual time=166.556..166.587 rows=419 loops=3)

  • Sort Key: selo.id_cartorio
  • Sort Method: quicksort Memory: 45kB
  • Worker 0: Sort Method: quicksort Memory: 44kB
  • Worker 1: Sort Method: quicksort Memory: 44kB
6. 0.561 166.379 ↑ 1.4 419 3 / 3

Nested Loop Left Join (cost=5,621.59..228,451.35 rows=583 width=8) (actual time=125.072..166.379 rows=419 loops=3)

  • Filter: ((selo_analisado.cs_situacao_isento <> 2) OR (selo_analisado.cs_situacao_isento IS NULL))
7. 4.867 164.141 ↑ 1.5 419 3 / 3

Parallel Hash Join (cost=5,621.18..228,115.48 rows=630 width=12) (actual time=125.031..164.141 rows=419 loops=3)

  • Hash Cond: (selo.id_selo_compensado = selo_compensado.id_selo_compensado)
8. 148.432 157.969 ↑ 1.3 40,788 3 / 3

Parallel Bitmap Heap Scan on selo (cost=2,609.73..224,960.78 rows=54,573 width=16) (actual time=40.790..157.969 rows=40,788 loops=3)

  • Recheck Cond: (cs_isento OR cs_gratuito)
  • Filter: ((cs_isento OR cs_gratuito) AND (cs_situacao_selo = 0))
  • Rows Removed by Filter: 913
  • Heap Blocks: exact=20,037
9. 0.001 9.537 ↓ 0.0 0 1 / 3

BitmapOr (cost=2,609.73..2,609.73 rows=133,251 width=0) (actual time=28.611..28.611 rows=0 loops=1)

10. 4.826 4.826 ↓ 2.4 121,504 1 / 3

Bitmap Index Scan on selo_cs_isento_idx (cost=0.00..967.88 rows=50,593 width=0) (actual time=14.477..14.477 rows=121,504 loops=1)

  • Index Cond: (cs_isento = true)
11. 4.710 4.710 ↓ 1.9 153,810 1 / 3

Bitmap Index Scan on selo_cs_gratuito_idx (cost=0.00..1,576.37 rows=82,658 width=0) (actual time=14.131..14.131 rows=153,810 loops=1)

  • Index Cond: (cs_gratuito = true)
12. 0.137 1.305 ↑ 2.9 425 3 / 3

Parallel Hash (cost=2,995.96..2,995.96 rows=1,239 width=4) (actual time=1.305..1.305 rows=425 loops=3)

  • Buckets: 4,096 Batches: 1 Memory Usage: 96kB
13. 0.553 1.168 ↓ 1.0 1,276 1 / 3

Parallel Bitmap Heap Scan on selo_compensado (cost=486.13..2,995.96 rows=1,239 width=4) (actual time=1.903..3.504 rows=1,276 loops=1)

  • Recheck Cond: ((dt_recurso >= '2020-06-01 00:00:00'::timestamp without time zone) AND (dt_recurso <= '2020-06-30 23:59:59'::timestamp without time zone) AND (cs_situacao_compensado IS NOT NULL) AND (cs_situacao_compensado = 1))
  • Heap Blocks: exact=214
14. 0.615 0.615 ↑ 1.7 1,276 1 / 3

Bitmap Index Scan on selo_compensado_cs_situacao_compensado_dt_recurso_idx (cost=0.00..485.60 rows=2,107 width=0) (actual time=1.844..1.844 rows=1,276 loops=1)

  • Index Cond: ((dt_recurso >= '2020-06-01 00:00:00'::timestamp without time zone) AND (dt_recurso <= '2020-06-30 23:59:59'::timestamp without time zone) AND (cs_situacao_compensado IS NOT NULL) AND (cs_situacao_compensado = 1))
15. 1.677 1.677 ↑ 1.0 1 1,258 / 3

Index Scan using selo_analisado_pkey on selo_analisado (cost=0.42..0.52 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=1,258)

  • Index Cond: (id_selo_analisado = selo.id_selo_analisado)