explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jiE2

Settings
# exclusive inclusive rows x rows loops node
1. 0.187 332.735 ↑ 4.8 20 1

GroupAggregate (cost=41,190.89..41,192.55 rows=95 width=12) (actual time=332.524..332.735 rows=20 loops=1)

  • Group Key: selo.id_cartorio
2. 0.518 332.548 ↓ 10.4 991 1

Sort (cost=41,190.89..41,191.12 rows=95 width=8) (actual time=332.487..332.548 rows=991 loops=1)

  • Sort Key: selo.id_cartorio
  • Sort Method: quicksort Memory: 71kB
3. 1.606 332.030 ↓ 10.4 991 1

Nested Loop Left Join (cost=10,205.48..41,187.77 rows=95 width=8) (actual time=218.488..332.030 rows=991 loops=1)

  • Filter: ((selo_analisado.cs_situacao_isento <> 2) OR (selo_analisado.cs_situacao_isento IS NULL))
4. 6.257 326.460 ↓ 9.6 991 1

Hash Join (cost=10,205.06..41,012.16 rows=103 width=12) (actual time=218.454..326.460 rows=991 loops=1)

  • Hash Cond: (selo.id_selo_compensado = selo_compensado.id_selo_compensado)
5. 217.205 317.317 ↓ 3.9 34,989 1

Bitmap Heap Scan on selo (cost=7,167.58..37,951.27 rows=8,920 width=16) (actual time=108.266..317.317 rows=34,989 loops=1)

  • Recheck Cond: ((cs_isento OR cs_gratuito) AND (id_cartorio = ANY ('{55,56,137,63,157,309,264,80,322,185,82,140,148,154,306,168,132,150,60,127}'::integer[])))
  • Rows Removed by Index Recheck: 67,942
  • Filter: ((cs_isento OR cs_gratuito) AND (cs_situacao_selo = 0))
  • Rows Removed by Filter: 460
  • Heap Blocks: exact=33,566
6. 3.933 100.112 ↓ 0.0 0 1

BitmapAnd (cost=7,167.58..7,167.58 rows=9,075 width=0) (actual time=100.112..100.112 rows=0 loops=1)

7. 0.002 35.210 ↓ 0.0 0 1

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

8. 17.022 17.022 ↓ 2.4 121,504 1

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

  • Index Cond: (cs_isento = true)
9. 18.186 18.186 ↓ 1.9 153,810 1

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

  • Index Cond: (cs_gratuito = true)
10. 60.969 60.969 ↓ 1.3 311,373 1

Bitmap Index Scan on selo_id_cartorio_idx (cost=0.00..4,616.40 rows=242,639 width=0) (actual time=60.969..60.969 rows=311,373 loops=1)

  • Index Cond: (id_cartorio = ANY ('{55,56,137,63,157,309,264,80,322,185,82,140,148,154,306,168,132,150,60,127}'::integer[]))
11. 0.343 2.886 ↑ 1.7 1,276 1

Hash (cost=3,011.14..3,011.14 rows=2,107 width=4) (actual time=2.886..2.886 rows=1,276 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 77kB
12. 0.970 2.543 ↑ 1.7 1,276 1

Bitmap Heap Scan on selo_compensado (cost=486.13..3,011.14 rows=2,107 width=4) (actual time=1.603..2.543 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
13. 1.573 1.573 ↑ 1.7 1,276 1

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.573..1.573 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))
14. 3.964 3.964 ↑ 1.0 1 991

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

  • Index Cond: (id_selo_analisado = selo.id_selo_analisado)