explain.depesz.com

PostgreSQL's explain analyze made readable

Result: EEH5

Settings
# exclusive inclusive rows x rows loops node
1. 0.551 33,943.676 ↓ 27.6 1,050 1

Unique (cost=222,381.68..222,381.87 rows=38 width=977) (actual time=33,942.786..33,943.676 rows=1,050 loops=1)

2. 7.360 33,943.125 ↓ 27.6 1,050 1

Sort (cost=222,381.68..222,381.77 rows=38 width=977) (actual time=33,942.782..33,943.125 rows=1,050 loops=1)

  • Sort Key: e.ema_env_codigo DESC, gec.ema_con_codigo DESC
  • Sort Method: quicksort Memory: 1,115kB
3. 1,117.173 33,935.765 ↓ 27.6 1,050 1

Nested Loop (cost=127,058.49..222,380.68 rows=38 width=977) (actual time=10,841.139..33,935.765 rows=1,050 loops=1)

4. 3.439 32,486.792 ↓ 30.9 1,050 1

Nested Loop Left Join (cost=127,058.07..222,259.97 rows=34 width=2,571) (actual time=10,839.582..32,486.792 rows=1,050 loops=1)

5. 5.029 32,472.853 ↓ 31.8 1,050 1

Nested Loop (cost=127,057.64..222,198.61 rows=33 width=2,575) (actual time=10,839.543..32,472.853 rows=1,050 loops=1)

6. 4.638 31,739.124 ↓ 31.8 1,050 1

Nested Loop (cost=127,057.21..222,086.99 rows=33 width=2,516) (actual time=10,838.856..31,739.124 rows=1,050 loops=1)

  • Join Filter: (c.rem_com_codigo = consumidores.rem_com_codigo)
7. 658.078 31,194.786 ↓ 31.8 1,050 1

Hash Join (cost=127,056.78..221,956.46 rows=33 width=2,161) (actual time=10,838.789..31,194.786 rows=1,050 loops=1)

  • Hash Cond: (gse.cod_arq_rem_consumidores = c.rem_com_codigo)
8. 23,878.530 23,878.530 ↑ 139.4 1,431 1

Seq Scan on ger_sms_enviados gse (cost=0.00..94,151.11 rows=199,530 width=1,431) (actual time=6.582..23,878.530 rows=1,431 loops=1)

  • Filter: ((cod_arq_ret_arquivo IS NOT NULL) AND (cod_arq_ret_arquivo_leitura IS NULL) AND (CASE WHEN ((CASE WHEN (((sms_env_response_carimbo ->> 'success'::text) = 'true'::text) OR ((sms_env_response_carimbo ->> 'success'::text) IS NULL)) THEN 'true'::text ELSE 'false'::text END = 'true'::text) AND (CASE WHEN (((sms_env_pagina_track_carimbo ->> 'success'::text) = 'true'::text) OR ((sms_env_pagina_track_carimbo ->> 'success'::text) IS NULL)) THEN 'true'::text ELSE 'false'::text END = 'true'::text) AND (sms_env_pagina_track_carimbo_date IS NOT NULL)) THEN to_char(sms_env_pagina_track_carimbo_date, 'DD/MM/YYYY HH24:MI:SS'::text) ELSE NULL::text END IS NOT NULL))
  • Rows Removed by Filter: 335,129
9. 617.538 6,658.178 ↓ 395.8 114,397 1

Hash (cost=127,053.17..127,053.17 rows=289 width=730) (actual time=6,658.178..6,658.178 rows=114,397 loops=1)

  • Buckets: 8,192 (originally 1024) Batches: 32 (originally 1) Memory Usage: 4,033kB
10. 45.050 6,040.640 ↓ 395.8 114,397 1

Nested Loop (cost=0.70..127,053.17 rows=289 width=730) (actual time=0.848..6,040.640 rows=114,397 loops=1)

11. 0.054 0.054 ↑ 2.8 8 1

Index Scan using arq_rem_arquivo_pkey on arq_rem_arquivo a (cost=0.28..9.05 rows=22 width=25) (actual time=0.012..0.054 rows=8 loops=1)

  • Index Cond: (rem_arq_codigo > 996)
  • Filter: (rem_arq_status = 'EN'::bpchar)
  • Rows Removed by Filter: 16
12. 5,995.536 5,995.536 ↓ 794.4 14,300 8

Index Scan using arq_rem_consumidores_cod_arq_rem_arquivo_idx on arq_rem_consumidores c (cost=0.43..5,774.55 rows=18 width=709) (actual time=0.768..749.442 rows=14,300 loops=8)

  • Index Cond: (cod_arq_rem_arquivo = a.rem_arq_codigo)
  • Filter: ((rem_com_dados ->> 'fluxo'::text) = 'A'::text)
  • Rows Removed by Filter: 428
13. 539.700 539.700 ↑ 1.0 1 1,050

Index Scan using arq_rem_consumidores_pkey on arq_rem_consumidores consumidores (cost=0.43..3.94 rows=1 width=355) (actual time=0.513..0.514 rows=1 loops=1,050)

  • Index Cond: (rem_com_codigo = gse.cod_arq_rem_consumidores)
14. 728.700 728.700 ↑ 1.0 1 1,050

Index Scan using ger_emails_enviados_cod_arq_rem_consumidores_idx on ger_emails_enviados e (cost=0.43..3.37 rows=1 width=71) (actual time=0.694..0.694 rows=1 loops=1,050)

  • Index Cond: (cod_arq_rem_consumidores = consumidores.rem_com_codigo)
  • Filter: ((ema_env_response_info ->> 'status'::text) <> 'sucesso'::text)
15. 10.500 10.500 ↑ 1.0 1 1,050

Index Only Scan using ger_emails_enviados_cod_arq_rem_consumidores_idx on ger_emails_enviados (cost=0.43..1.85 rows=1 width=4) (actual time=0.009..0.010 rows=1 loops=1,050)

  • Index Cond: (cod_arq_rem_consumidores = consumidores.rem_com_codigo)
  • Heap Fetches: 0
16. 331.800 331.800 ↑ 1.0 1 1,050

Index Scan using ger_emails_consulta_cod_ger_emails_enviados_idx on ger_emails_consulta gec (cost=0.43..3.30 rows=1 width=284) (actual time=0.315..0.316 rows=1 loops=1,050)

  • Index Cond: (cod_ger_emails_enviados = e.ema_env_codigo)
Planning time : 15.618 ms
Execution time : 33,945.590 ms