explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UKkB

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 1,546.893 ↑ 91.0 1 1

Sort (cost=22,742.44..22,742.67 rows=91 width=12) (actual time=1,546.893..1,546.893 rows=1 loops=1)

  • Sort Key: (count(selo.tx_numero_selo)) DESC
  • Sort Method: quicksort Memory: 25kB
2. 0.012 1,546.887 ↑ 91.0 1 1

GroupAggregate (cost=6,935.36..22,739.48 rows=91 width=12) (actual time=1,546.887..1,546.887 rows=1 loops=1)

  • Group Key: selo.id_cartorio
3. 0.029 1,546.875 ↑ 10.1 9 1

Nested Loop Left Join (cost=6,935.36..22,738.11 rows=91 width=33) (actual time=63.446..1,546.875 rows=9 loops=1)

  • Filter: ((selo_compensado.cs_situacao_compensado IS NULL) OR (selo_compensado.automatico AND (selo_compensado.cs_situacao_compensado <> ALL ('{0,1}'::integer[]))))
  • Rows Removed by Filter: 76
4. 3.662 1,546.421 ↑ 2.3 85 1

Merge Join (cost=6,934.94..21,326.00 rows=193 width=37) (actual time=63.426..1,546.421 rows=85 loops=1)

  • Merge Cond: (selo.id_selo_analisado = selo_analisado.id_selo_analisado)
5. 1,510.399 1,510.399 ↓ 1.9 556 1

Index Scan using selo_id_selo_analisado_idx on selo (cost=0.43..1,061,133.81 rows=300 width=41) (actual time=1.408..1,510.399 rows=556 loops=1)

  • Filter: (cs_isento AND (NOT cs_gratuito) AND (cs_situacao_selo = 0) AND (id_cartorio = 82))
  • Rows Removed by Filter: 3,562,289
6. 14.524 32.360 ↑ 1.0 48,285 1

Sort (cost=6,934.09..7,055.59 rows=48,598 width=4) (actual time=29.489..32.360 rows=48,285 loops=1)

  • Sort Key: selo_analisado.id_selo_analisado
  • Sort Method: quicksort Memory: 3,637kB
7. 17.836 17.836 ↑ 1.0 48,453 1

Seq Scan on selo_analisado (cost=0.00..3,151.07 rows=48,598 width=4) (actual time=0.011..17.836 rows=48,453 loops=1)

  • Filter: (cs_situacao_isento = 0)
  • Rows Removed by Filter: 27,073
8. 0.425 0.425 ↑ 1.0 1 85

Index Scan using selo_compensado_pkey on selo_compensado (cost=0.42..7.30 rows=1 width=9) (actual time=0.005..0.005 rows=1 loops=85)

  • Index Cond: (id_selo_compensado = selo.id_selo_compensado)