explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Cpk7

Settings
# exclusive inclusive rows x rows loops node
1. 0.054 4,613.586 ↓ 25.0 25 1

Sort (cost=63,911.19..63,911.20 rows=1 width=24) (actual time=4,613.584..4,613.586 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.152 4,613.532 ↓ 25.0 25 1

Nested Loop Left Join (cost=410.29..63,911.18 rows=1 width=24) (actual time=270.898..4,613.532 rows=25 loops=1)

  • Filter: ((selo_analisado.cs_situacao_isento <> 2) OR (selo_analisado.cs_situacao_isento IS NULL))
3. 128.490 4,612.855 ↓ 25.0 25 1

Nested Loop (cost=409.87..63,910.19 rows=1 width=29) (actual time=270.867..4,612.855 rows=25 loops=1)

  • Join Filter: ((selo.id_selo_compensado)::integer = selo_compensado.id_selo_compensado)
  • Rows Removed by Join Filter: 1,038,481
4. 0.571 0.571 ↓ 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.029..0.571 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. 4,359.579 4,483.794 ↓ 1.0 21,194 49

Bitmap Heap Scan on selo (cost=409.45..63,065.56 rows=20,607 width=28) (actual time=5.842..91.506 rows=21,194 loops=49)

  • Recheck Cond: (id_cartorio = 137)
  • Filter: (cs_situacao_selo = 0)
  • Rows Removed by Filter: 46
  • Heap Blocks: exact=908,019
6. 124.215 124.215 ↓ 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.535..2.535 rows=26,476 loops=49)

  • Index Cond: (id_cartorio = 137)
7. 0.525 0.525 ↑ 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.021..0.021 rows=1 loops=25)

  • Index Cond: (id_selo_analisado = (selo.id_selo_analisado)::integer)