explain.depesz.com

PostgreSQL's explain analyze made readable

Result: P9U2

Settings
# exclusive inclusive rows x rows loops node
1. 0.181 257.990 ↑ 4.8 20 1

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

  • Group Key: selo.id_cartorio
2. 0.310 257.809 ↓ 10.4 991 1

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

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

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

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

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

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

Bitmap Heap Scan on selo (cost=7,167.58..37,951.27 rows=8,920 width=16) (actual time=73.207..244.668 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.281 66.494 ↓ 0.0 0 1

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

7. 0.002 24.263 ↓ 0.0 0 1

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

8. 12.096 12.096 ↓ 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=12.096..12.096 rows=121,504 loops=1)

  • Index Cond: (cs_isento = true)
9. 12.165 12.165 ↓ 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=12.165..12.165 rows=153,810 loops=1)

  • Index Cond: (cs_gratuito = true)
10. 38.950 38.950 ↓ 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=38.950..38.950 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.276 3.125 ↑ 1.7 1,276 1

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

  • Buckets: 4,096 Batches: 1 Memory Usage: 77kB
12. 1.312 2.849 ↑ 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.573..2.849 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.537 1.537 ↑ 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.537..1.537 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. 2.973 2.973 ↑ 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.003..0.003 rows=1 loops=991)

  • Index Cond: (id_selo_analisado = selo.id_selo_analisado)