explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ySk2

Settings
# exclusive inclusive rows x rows loops node
1. 0.047 119.973 ↓ 25.0 25 1

Sort (cost=1,688.61..1,688.61 rows=1 width=24) (actual time=119.971..119.973 rows=25 loops=1)

  • Sort Key: selo.id_selo DESC, (CASE selo_compensado.pode_recorrer WHEN CASE_TEST_EXPR THEN 0 WHEN (NOT CASE_TEST_EXPR) THEN 1 ELSE NULL::integer END), selo_compensado.dt_recurso, selo.dt_selo
  • Sort Method: quicksort Memory: 26kB
2. 0.118 119.926 ↓ 25.0 25 1

Nested Loop Left Join (cost=740.60..1,688.60 rows=1 width=24) (actual time=7.050..119.926 rows=25 loops=1)

  • Filter: ((selo_analisado.cs_situacao_isento <> 2) OR (selo_analisado.cs_situacao_isento IS NULL))
3. 0.241 119.458 ↓ 25.0 25 1

Nested Loop (cost=740.19..1,687.61 rows=1 width=29) (actual time=7.005..119.458 rows=25 loops=1)

4. 0.441 0.441 ↓ 49.0 49 1

Index Scan using selo_compensado_categoria_idx on selo_compensado (cost=0.42..535.52 rows=1 width=13) (actual time=0.025..0.441 rows=49 loops=1)

  • Index Cond: (categoria = 8)
  • Filter: ((cs_situacao_compensado IS NOT NULL) AND (dt_recurso >= '2020-07-01 00:00:00'::timestamp without time zone) AND (dt_recurso <= '2020-07-31 23:59:59'::timestamp without time zone) AND (cs_situacao_compensado = 1))
  • Rows Removed by Filter: 161
5. 0.245 118.776 ↑ 103.0 1 49

Bitmap Heap Scan on selo (cost=739.77..1,151.05 rows=103 width=28) (actual time=2.424..2.424 rows=1 loops=49)

  • Recheck Cond: ((id_selo_compensado = selo_compensado.id_selo_compensado) AND (id_cartorio = 137))
  • Filter: (cs_situacao_selo = 0)
  • Heap Blocks: exact=25
6. 0.147 118.531 ↓ 0.0 0 49

BitmapAnd (cost=739.77..739.77 rows=104 width=0) (actual time=2.419..2.419 rows=0 loops=49)

7. 0.294 0.294 ↑ 17,814.0 1 49

Bitmap Index Scan on selo_id_selo_compensado_idx (cost=0.00..330.04 rows=17,814 width=0) (actual time=0.006..0.006 rows=1 loops=49)

  • Index Cond: (id_selo_compensado = selo_compensado.id_selo_compensado)
8. 118.090 118.090 ↓ 1.3 26,476 49

Bitmap Index Scan on selo_id_cartorio_idx (cost=0.00..404.30 rows=20,783 width=0) (actual time=2.410..2.410 rows=26,476 loops=49)

  • Index Cond: (id_cartorio = 137)
9. 0.350 0.350 ↑ 1.0 1 25

Index Scan using selo_analisado_pkey on selo_analisado (cost=0.42..0.98 rows=1 width=8) (actual time=0.014..0.014 rows=1 loops=25)

  • Index Cond: (id_selo_analisado = selo.id_selo_analisado)