explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7qBa

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 4,878.824 8,731.490 ↓ 1.2 1,264,849 1

Nested Loop (cost=978,240.46..14,874,171.84 rows=1,069,957 width=133) (actual time=941.714..8,731.490 rows=1,264,849 loops=1)

2. 401.737 1,962.993 ↓ 1.1 629,891 1

Merge Join (cost=978,239.88..988,279.48 rows=574,073 width=86) (actual time=941.611..1,962.993 rows=629,891 loops=1)

  • Merge Cond: (date_to_process.id_associado = associadovenda.asv_id_associado)
3. 1.967 3.030 ↑ 1.1 3,637 1

Sort (cost=309.48..319.68 rows=4,080 width=4) (actual time=1.957..3.030 rows=3,637 loops=1)

  • Sort Key: date_to_process.id_associado
  • Sort Method: quicksort Memory: 267kB
4. 1.063 1.063 ↑ 1.1 3,637 1

Seq Scan on date_to_process (cost=0.00..64.80 rows=4,080 width=4) (actual time=0.009..1.063 rows=3,637 loops=1)

5. 304.712 1,558.226 ↓ 1.1 629,891 1

Materialize (cost=977,930.40..980,746.59 rows=563,239 width=86) (actual time=939.648..1,558.226 rows=629,891 loops=1)

6. 849.211 1,253.514 ↓ 1.1 629,891 1

Sort (cost=977,930.40..979,338.50 rows=563,239 width=86) (actual time=939.642..1,253.514 rows=629,891 loops=1)

  • Sort Key: associadovenda.asv_id_associado
  • Sort Method: external merge Disk: 39192kB
7. 386.507 404.303 ↓ 1.1 629,891 1

Index Scan using idx_data_referencia on associadovenda (cost=4,940.06..908,344.48 rows=563,239 width=86) (actual time=17.859..404.303 rows=629,891 loops=1)

  • Index Cond: ((asv_data_referencia >= '2018-09-05 00:00:00'::timestamp without time zone) AND (asv_data_referencia <= '2018-09-05 23:59:59'::timestamp without time zone))
  • Filter: (NOT (hashed SubPlan 1))
8.          

SubPlan (forIndex Scan)

9. 17.796 17.796 ↓ 1.0 22 1

Seq Scan on associado (cost=0.00..4,939.43 rows=21 width=4) (actual time=0.014..17.796 rows=22 loops=1)

  • Filter: (asd_erp <> ALL ('{1,2,3}'::integer[]))
  • Rows Removed by Filter: 6558
10. 1,889.673 1,889.673 ↑ 276.5 2 629,891

Index Scan using idx_110744_fkassociadov84690 on associadovendaitens (cost=0.57..18.16 rows=553 width=51) (actual time=0.002..0.003 rows=2 loops=629,891)

  • Index Cond: (asi_id_venda = associadovenda.asv_id)