explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ewEd

Settings
# exclusive inclusive rows x rows loops node
1. 3,302.002 22,460.959 ↓ 0.0 0 1

Hash Join (cost=36,504,561.44..36,857,726.51 rows=1,298,000 width=41) (actual time=22,460.959..22,460.959 rows=0 loops=1)

  • Hash Cond: ((processo_contab.cd_empresa = doc.cd_empresa) AND (processo_contab.cd_base = doc.cd_base) AND (processo_contab.seq_processo = doc.seq_processo))
2. 1,953.567 1,953.567 ↓ 1.0 10,804,223 1

Seq Scan on processo_contab (cost=0.00..236,344.99 rows=10,383,999 width=41) (actual time=0.021..1,953.567 rows=10,804,223 loops=1)

3. 0.046 17,205.390 ↑ 6,177.0 25 1

Hash (cost=36,501,859.00..36,501,859.00 rows=154,425 width=24) (actual time=17,205.390..17,205.390 rows=25 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 2050kB
4. 0.937 17,205.344 ↑ 6,177.0 25 1

HashAggregate (cost=36,498,770.50..36,500,314.75 rows=154,425 width=24) (actual time=17,204.465..17,205.344 rows=25 loops=1)

  • Group Key: doc.cd_empresa, doc.cd_base, doc.seq_processo
5. 228.624 17,204.407 ↑ 8,715.9 25 1

Nested Loop (cost=9,051.50..36,497,136.26 rows=217,898 width=24) (actual time=4,130.562..17,204.407 rows=25 loops=1)

6. 222.705 829.127 ↓ 1.4 212,456 1

Hash Anti Join (cost=9,050.94..178,412.90 rows=149,633 width=24) (actual time=115.926..829.127 rows=212,456 loops=1)

  • Hash Cond: ((doc.cd_empresa = can.cd_empresa) AND (doc.cd_base = can.cd_base) AND (doc.seq_processo = can.seq_processo))
7. 493.491 527.343 ↓ 1.4 215,271 1

Bitmap Heap Scan on est_documento doc (cost=3,655.84..170,289.20 rows=154,425 width=24) (actual time=36.233..527.343 rows=215,271 loops=1)

  • Recheck Cond: ((dt_movimento >= '2018-08-01'::date) AND (dt_movimento <= ('now'::cstring)::date))
  • Filter: ((id_situacao_eletronica = ANY ('{0,9}'::bpchar[])) AND (cd_empresa = 1))
  • Rows Removed by Filter: 107
  • Heap Blocks: exact=11640
8. 33.852 33.852 ↓ 1.3 224,297 1

Bitmap Index Scan on est_documento_dt_movimento (cost=0.00..3,617.24 rows=169,280 width=0) (actual time=33.852..33.852 rows=224,297 loops=1)

  • Index Cond: ((dt_movimento >= '2018-08-01'::date) AND (dt_movimento <= ('now'::cstring)::date))
9. 39.127 79.079 ↓ 1.0 126,447 1

Hash (cost=3,187.12..3,187.12 rows=126,170 width=24) (actual time=79.079..79.079 rows=126,447 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 7940kB
10. 39.952 39.952 ↓ 1.0 126,447 1

Seq Scan on processo_canc can (cost=0.00..3,187.12 rows=126,170 width=24) (actual time=0.027..39.952 rows=126,447 loops=1)

  • Filter: (cd_empresa = 1)
11. 2,565.124 16,146.656 ↓ 0.0 0 212,456

Index Only Scan using est_doc_item_pk on est_doc_item ite (cost=0.56..242.65 rows=7 width=24) (actual time=0.076..0.076 rows=0 loops=212,456)

  • Index Cond: ((cd_empresa = 1) AND (cd_base = doc.cd_base) AND (seq_processo = doc.seq_processo))
  • Filter: ((NOT (SubPlan 1)) OR ((NOT (SubPlan 2)) AND (SubPlan 3)))
  • Rows Removed by Filter: 2
  • Heap Fetches: 477652
12.          

SubPlan (forIndex Only Scan)

13. 8,249.312 8,249.312 ↑ 2.0 1 515,582

Index Only Scan using pre_partida_produto_pk on pre_partida_produto pre (cost=0.56..8.62 rows=2 width=0) (actual time=0.016..0.016 rows=1 loops=515,582)

  • Index Cond: ((cd_empresa = ite.cd_empresa) AND (cd_base = ite.cd_base) AND (seq_processo = ite.seq_processo) AND (seq_item = ite.seq_item))
  • Heap Fetches: 217800
14. 5,155.570 5,155.570 ↑ 1.0 1 515,557

Index Only Scan using pre_partida_imposto_pk on pre_partida_imposto pre_1 (cost=0.56..8.59 rows=1 width=0) (actual time=0.010..0.010 rows=1 loops=515,557)

  • Index Cond: ((cd_empresa = ite.cd_empresa) AND (cd_base = ite.cd_base) AND (seq_processo = ite.seq_processo) AND (seq_item = ite.seq_item))
  • Heap Fetches: 358560
15. 176.650 176.650 ↓ 0.0 0 35,330

Index Only Scan using est_doc_item_imposto_pk on est_doc_item_imposto imp (cost=0.56..8.59 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=35,330)

  • Index Cond: ((cd_empresa = ite.cd_empresa) AND (cd_base = ite.cd_base) AND (seq_processo = ite.seq_processo) AND (seq_item = ite.seq_item))
  • Filter: ((cd_imposto)::text <> 'ISS'::text)
  • Rows Removed by Filter: 0
  • Heap Fetches: 511