explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Q6vt

Settings
# exclusive inclusive rows x rows loops node
1. 0.688 411.975 ↑ 1.0 1 1

Aggregate (cost=51,669.19..51,669.20 rows=1 width=0) (actual time=411.975..411.975 rows=1 loops=1)

2. 85.268 411.287 ↓ 317.4 12,061 1

Nested Loop (cost=0.85..51,669.09 rows=38 width=0) (actual time=304.513..411.287 rows=12,061 loops=1)

  • Join Filter: ((cv.dt_venda_aj >= c.dt_inicio) AND (cv.dt_venda_aj <= c.dt_final) AND (e_lj.t_estab_adq_id = ro.t_estab_adq_id))
  • Rows Removed by Join Filter: 615,111
3. 0.074 0.239 ↓ 13.0 52 1

Nested Loop (cost=0.14..17.09 rows=4 width=20) (actual time=0.012..0.239 rows=52 loops=1)

  • Join Filter: (e_lj.t_contrato_id = c.id)
  • Rows Removed by Join Filter: 156
4. 0.113 0.113 ↑ 1.0 52 1

Index Scan using fk_t_estab_adq_estabel1_idx on t_estab_adq_loja_contrato e_lj (cost=0.14..12.92 rows=52 width=12) (actual time=0.005..0.113 rows=52 loops=1)

5. 0.047 0.052 ↑ 1.0 4 52

Materialize (cost=0.00..1.06 rows=4 width=20) (actual time=0.000..0.001 rows=4 loops=52)

6. 0.005 0.005 ↑ 1.0 4 1

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

7. 32.894 325.780 ↓ 2.7 12,061 52

Materialize (cost=0.71..51,307.13 rows=4,450 width=12) (actual time=0.003..6.265 rows=12,061 loops=52)

8. 10.959 292.886 ↓ 2.7 12,061 1

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

9. 12.102 269.866 ↓ 2.7 12,061 1

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

10. 233.642 233.642 ↓ 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.121..233.642 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)
Planning time : 1.139 ms
Execution time : 412.159 ms