explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dhUE

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=5,865.98..5,866.28 rows=10 width=106) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Unique (cost=5,865.98..5,869.01 rows=101 width=106) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Sort (cost=5,865.98..5,866.24 rows=101 width=106) (actual rows= loops=)

  • Sort Key: l.lead_quente DESC, (COALESCE(l.nome, l.razao_social, l.email)), l.id_lead, l.natureza, l.bem_interesse, (parsevalor(l.valor_bem)), l.novo, l.validado, l.email, (CASE WHEN (ls.status <> 'qualificar'::text) THEN true ELSE false END), (CASE WHEN ((NOT l.bloquear_redistribuicao) AND (CASE WHEN (ls.status = 'qualificar'::text) THEN (SubPlan 1) ELSE (SubPlan 2) END >= CASE WHEN (ls.status = 'qualificado_sem_agendamento'::text) THEN 9997 WHEN (ls.status = 'qualificar'::text) THEN '-3'::integer WHEN (ls.status = 'qualificado_com_agendamento'::text) THEN 9997 WHEN (ls.status = 'em_reuniao'::text) THEN '-1'::integer ELSE NULL::integer END)) THEN true ELSE false END)
4. 0.000 0.000 ↓ 0.0

Hash Join (cost=4.78..5,862.62 rows=101 width=106) (actual rows= loops=)

  • Hash Cond: (l.id_lead_status = ls.id_lead_status)
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..20.68 rows=101 width=99) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Seq Scan on tb_unidade_negocio un (cost=0.00..1.15 rows=1 width=4) (actual rows= loops=)

  • Filter: (id_unidade_negocio = 1)
7. 0.000 0.000 ↓ 0.0

Seq Scan on tb_lead l (cost=0.00..18.52 rows=101 width=103) (actual rows= loops=)

  • Filter: ((NOT bloqueado) AND (id_unidade_negocio = 1) AND (id_usuario = 418))
8. 0.000 0.000 ↓ 0.0

Hash (cost=3.51..3.51 rows=101 width=15) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Seq Scan on tb_lead_status ls (cost=0.00..3.51 rows=101 width=15) (actual rows= loops=)

  • Filter: ((status <> 'desqualificado'::text) AND (status <> 'cliente'::text))
10.          

SubPlan (forHash Join)

11. 0.000 0.000 ↓ 0.0

Aggregate (cost=32.51..32.52 rows=1 width=8) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Function Scan on generate_series i (cost=0.03..30.03 rows=990 width=0) (actual rows= loops=)

  • Filter: (date_part('dow'::text, (l.modificado + (((i)::text || ' hours'::text))::interval)) <> ALL ('{0,6}'::double precision[]))
13. 0.000 0.000 ↓ 0.0

Aggregate (cost=24.99..25.00 rows=1 width=8) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Function Scan on generate_series i_1 (cost=0.01..22.51 rows=990 width=0) (actual rows= loops=)

  • Filter: (date_part('dow'::text, (((l.modificado)::date + i))::timestamp without time zone) <> ALL ('{0,6}'::double precision[]))