explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lUcE : Optimization for: jornada; plan #TaY5

Settings

Optimization path:

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

GroupAggregate (cost=99,615.30..99,621.05 rows=200 width=12) (actual rows= loops=)

  • Group Key: (CASE WHEN (ultimo_evento_motorista.evento = ANY ('{1,29,3,5,7,12}'::integer[])) THEN 1 WHEN (ultimo_evento_motorista.evento = ANY ('{8,9,30}'::integer[])) THEN 8 ELSE ultimo_evento_motorista.evento END)
2.          

CTE ultimo_evento_motorista

3. 0.000 0.000 ↓ 0.0

Unique (cost=99,013.72..99,601.41 rows=200 width=20) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=99,013.72..99,307.56 rows=117,538 width=20) (actual rows= loops=)

  • Sort Key: evento.motorista_id, evento.datahora DESC
5. 0.000 0.000 ↓ 0.0

Append (cost=0.00..87,392.89 rows=117,538 width=20) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Seq Scan on evento (cost=0.00..0.00 rows=1 width=20) (actual rows= loops=)

  • Filter: ((NOT excecao) AND (datahora >= '2019-04-15 00:00:00+00'::timestamp with time zone) AND (motorista_id = ANY ('{183814,183907,184639,184818,184861,185538,185772,185849,185974,185986,186002,186166,186339,186620,187128,1873 (...)
7. 0.000 0.000 ↓ 0.0

Index Scan using idx_temp_04 on evento evento_1 (cost=0.43..57,667.49 rows=59,599 width=20) (actual rows= loops=)

  • Index Cond: (motorista_id = ANY ('{183814,183907,184639,184818,184861,185538,185772,185849,185974,185986,186002,186166,186339,186620,187128,187328,187447,187465,187485,188143,189165,189417,189503,189545,189899,189950,192433,1956 (...)
  • Filter: ((NOT excecao) AND (datahora >= '2019-04-15 00:00:00+00'::timestamp with time zone))
8. 0.000 0.000 ↓ 0.0

Index Scan using idx_temp_05 on evento evento_2 (cost=0.42..29,676.14 rows=57,901 width=20) (actual rows= loops=)

  • Index Cond: (motorista_id = ANY ('{183814,183907,184639,184818,184861,185538,185772,185849,185974,185986,186002,186166,186339,186620,187128,187328,187447,187465,187485,188143,189165,189417,189503,189545,189899,189950,192433,1956 (...)
  • Filter: ((NOT excecao) AND (datahora >= '2019-04-15 00:00:00+00'::timestamp with time zone))
9. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on evento evento_3 (cost=2.88..49.26 rows=37 width=20) (actual rows= loops=)

  • Recheck Cond: (datahora >= '2019-04-15 00:00:00+00'::timestamp with time zone)
  • Filter: ((NOT excecao) AND (motorista_id = ANY ('{183814,183907,184639,184818,184861,185538,185772,185849,185974,185986,186002,186166,186339,186620,187128,187328,187447,187465,187485,188143,189165,189417,189503,189545,189899,189 (...)
10. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_2019_06_evento_dia_vei (cost=0.00..2.88 rows=97 width=0) (actual rows= loops=)

  • Index Cond: (datahora >= '2019-04-15 00:00:00+00'::timestamp with time zone)
11. 0.000 0.000 ↓ 0.0

Sort (cost=13.89..14.39 rows=200 width=12) (actual rows= loops=)

  • Sort Key: (CASE WHEN (ultimo_evento_motorista.evento = ANY ('{1,29,3,5,7,12}'::integer[])) THEN 1 WHEN (ultimo_evento_motorista.evento = ANY ('{8,9,30}'::integer[])) THEN 8 ELSE ultimo_evento_motorista.evento END)
12. 0.000 0.000 ↓ 0.0

CTE Scan on ultimo_evento_motorista (cost=0.00..6.25 rows=200 width=12) (actual rows= loops=)