explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TGNW

Settings
# exclusive inclusive rows x rows loops node
1. 0.717 491.508 ↑ 1.0 1 1

Aggregate (cost=51,542.24..51,542.25 rows=1 width=0) (actual time=491.508..491.508 rows=1 loops=1)

2. 48.612 490.791 ↓ 12,061.0 12,061 1

Nested Loop (cost=5.13..51,542.24 rows=1 width=0) (actual time=433.164..490.791 rows=12,061 loops=1)

  • Join Filter: ((ro.t_estab_adq_id = e_lj.t_estab_adq_id) AND (c.id = e_lj.t_contrato_id))
  • Rows Removed by Join Filter: 615,111
3. 0.023 0.023 ↑ 1.0 52 1

Seq Scan on t_estab_adq_loja_contrato e_lj (cost=0.00..1.52 rows=52 width=12) (actual time=0.004..0.023 rows=52 loops=1)

4. 26.077 442.156 ↓ 241.2 12,061 52

Materialize (cost=5.13..51,495.34 rows=50 width=12) (actual time=0.007..8.503 rows=12,061 loops=52)

5. 11.262 416.079 ↓ 241.2 12,061 1

Nested Loop (cost=5.13..51,495.09 rows=50 width=12) (actual time=0.350..416.079 rows=12,061 loops=1)

  • Join Filter: ((cv.dt_venda_aj >= c.dt_inicio) AND (cv.dt_venda_aj <= c.dt_final))
  • Rows Removed by Join Filter: 36,183
6. 68.491 404.817 ↓ 106.7 12,061 1

Nested Loop (cost=5.13..51,486.13 rows=113 width=16) (actual time=0.345..404.817 rows=12,061 loops=1)

  • Join Filter: (abm.id = ro.t_adq_band_modl_id)
  • Rows Removed by Join Filter: 964,880
7. 3.793 288.082 ↓ 2.7 12,061 1

Hash Join (cost=2.03..51,347.38 rows=4,450 width=20) (actual time=0.199..288.082 rows=12,061 loops=1)

  • Hash Cond: (ro.t_estab_adq_id = est.id)
8. 10.259 284.282 ↓ 2.7 12,061 1

Nested Loop (cost=0.71..51,284.88 rows=4,450 width=16) (actual time=0.185..284.282 rows=12,061 loops=1)

9. 6.055 261.962 ↓ 2.7 12,061 1

Nested Loop (cost=0.42..49,736.02 rows=4,450 width=12) (actual time=0.179..261.962 rows=12,061 loops=1)

10. 231.785 231.785 ↓ 2.7 12,061 1

Seq Scan on t_parcelas_adq parc (cost=0.00..29,425.52 rows=4,450 width=8) (actual time=0.169..231.785 rows=12,061 loops=1)

  • Filter: (CASE WHEN ((fl_conc_pagto)::text ~~ 'LIQUIDADO%'::text) THEN dt_pagto WHEN (nova_data IS NOT NULL) THEN nova_data ELSE data_vencimento END = '2020-09-14 00:00:00'::timestamp without time zone)
  • Rows Removed by Filter: 877,907
11. 24.122 24.122 ↑ 1.0 1 12,061

Index Scan using t_cv_adq_pkey on t_cv_adq cv (cost=0.42..4.55 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=12,061)

  • Index Cond: (id = parc.t_cv_adq_id)
12. 12.061 12.061 ↑ 1.0 1 12,061

Index Scan using t_ro_adq_pkey on t_ro_adq ro (cost=0.29..0.34 rows=1 width=28) (actual time=0.001..0.001 rows=1 loops=12,061)

  • Index Cond: (id = cv.t_ro_adq_id)
13. 0.004 0.007 ↑ 1.0 14 1

Hash (cost=1.14..1.14 rows=14 width=4) (actual time=0.007..0.007 rows=14 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
14. 0.003 0.003 ↑ 1.0 14 1

Seq Scan on t_estab_adq est (cost=0.00..1.14 rows=14 width=4) (actual time=0.001..0.003 rows=14 loops=1)

15. 48.030 48.244 ↓ 40.5 81 12,061

Materialize (cost=3.10..5.25 rows=2 width=4) (actual time=0.000..0.004 rows=81 loops=12,061)

16. 0.016 0.214 ↓ 40.5 81 1

Nested Loop (cost=3.10..5.24 rows=2 width=4) (actual time=0.039..0.214 rows=81 loops=1)

17. 0.031 0.117 ↓ 40.5 81 1

Nested Loop (cost=2.97..4.62 rows=2 width=8) (actual time=0.034..0.117 rows=81 loops=1)

18. 0.011 0.039 ↓ 47.0 47 1

Hash Join (cost=2.83..4.03 rows=1 width=4) (actual time=0.030..0.039 rows=47 loops=1)

  • Hash Cond: (band.id = bmb.t_band_id)
19. 0.002 0.002 ↑ 1.0 14 1

Seq Scan on t_band band (cost=0.00..1.14 rows=14 width=4) (actual time=0.001..0.002 rows=14 loops=1)

20. 0.012 0.026 ↓ 11.8 47 1

Hash (cost=2.78..2.78 rows=4 width=8) (actual time=0.026..0.026 rows=47 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
21. 0.008 0.014 ↓ 11.8 47 1

Hash Join (cost=1.09..2.78 rows=4 width=8) (actual time=0.008..0.014 rows=47 loops=1)

  • Hash Cond: (bmb.t_modl_band_id = mdl.id)
22. 0.004 0.004 ↑ 1.0 47 1

Seq Scan on t_band_modl_band bmb (cost=0.00..1.47 rows=47 width=12) (actual time=0.002..0.004 rows=47 loops=1)

23. 0.001 0.002 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=4) (actual time=0.002..0.002 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
24. 0.001 0.001 ↑ 1.0 4 1

Seq Scan on t_modl_band mdl (cost=0.00..1.04 rows=4 width=4) (actual time=0.001..0.001 rows=4 loops=1)

25. 0.047 0.047 ↑ 2.0 2 47

Index Scan using fk_t_adq_has_t_band_modl_ban_1 on t_adq_band_modl abm (cost=0.14..0.55 rows=4 width=12) (actual time=0.001..0.001 rows=2 loops=47)

  • Index Cond: (t_band_modl_band_id = bmb.id)
26. 0.081 0.081 ↑ 1.0 1 81

Index Only Scan using t_adq_pkey on t_adq adq (cost=0.14..0.30 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=81)

  • Index Cond: (id = abm.t_adq_id)
  • Heap Fetches: 81
27. 0.000 0.000 ↑ 1.0 4 12,061

Materialize (cost=0.00..1.06 rows=4 width=20) (actual time=0.000..0.000 rows=4 loops=12,061)

28. 0.002 0.002 ↑ 1.0 4 1

Seq Scan on t_contrato c (cost=0.00..1.04 rows=4 width=20) (actual time=0.002..0.002 rows=4 loops=1)

Planning time : 1.669 ms
Execution time : 491.731 ms