explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Cip1 : teste

Settings
# exclusive inclusive rows x rows loops node
1. 0.011 718,338.710 ↑ 16.0 13 1

Sort (cost=115,597.81..115,598.33 rows=208 width=32) (actual time=718,338.709..718,338.710 rows=13 loops=1)

  • Sort Key: (date_trunc('year'::text, lower(lawsuit_clients_history_1.sys_period))), (date_trunc('month'::text, lower(lawsuit_clients_history_1.sys_period)))
  • Sort Method: quicksort Memory: 26kB
2. 224,612.705 718,338.699 ↑ 16.0 13 1

HashAggregate (cost=115,585.64..115,589.80 rows=208 width=32) (actual time=718,338.695..718,338.699 rows=13 loops=1)

  • Group Key: date_trunc('year'::text, lower(lawsuit_clients_history_1.sys_period)), date_trunc('month'::text, lower(lawsuit_clients_history_1.sys_period))
3. 442,654.421 493,725.994 ↓ 136.3 460,112,272 1

Nested Loop (cost=1,000.57..81,825.16 rows=3,376,048 width=30) (actual time=0.517..493,725.994 rows=460,112,272 loops=1)

4. 54.397 54.397 ↓ 1.0 16,232 1

Seq Scan on lawsuit_clients (cost=0.00..931.48 rows=16,231 width=0) (actual time=0.005..54.397 rows=16,232 loops=1)

  • Filter: ((value_cause_1a >= '0'::double precision) AND (value_cause_1a <= '500000000'::double precision))
5. 50,754.506 51,017.176 ↓ 136.3 28,346 16,232

Materialize (cost=1,000.57..4,933.12 rows=208 width=36) (actual time=0.001..3.143 rows=28,346 loops=16,232)

6. 0.000 262.670 ↓ 136.3 28,346 1

Gather (cost=1,000.57..4,932.08 rows=208 width=36) (actual time=0.508..262.670 rows=28,346 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
7. 224.900 273.080 ↓ 116.2 14,173 2

Nested Loop Left Join (cost=0.57..3,911.28 rows=122 width=36) (actual time=0.083..273.080 rows=14,173 loops=2)

8. 36.273 48.165 ↓ 116.2 14,173 2

Nested Loop Left Join (cost=0.28..2,019.29 rows=122 width=52) (actual time=0.052..48.165 rows=14,173 loops=2)

9. 11.890 11.890 ↓ 116.2 14,173 2

Parallel Seq Scan on lawsuit_clients_history lawsuit_clients_history_1 (cost=0.00..1,934.54 rows=122 width=52) (actual time=0.040..11.890 rows=14,173 loops=2)

  • Filter: (((status)::text = 'ATIVO'::text) AND (lower(sys_period) >= '2018-01-01 00:00:00'::timestamp without time zone) AND (lower(sys_period) <= '2019-01-01 00:00:00'::timestamp without time zone))
  • Rows Removed by Filter: 6588
10. 0.002 0.002 ↑ 1.0 1 28,346

Index Only Scan using lawsuit_business_history_client_lawsuit_id_idx on lawsuit_business_history (cost=0.28..0.68 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=28,346)

  • Index Cond: (client_lawsuit_id = lawsuit_clients_history_1.client_lawsuit_id)
  • Heap Fetches: 0
11. 0.015 0.015 ↓ 0.0 0 28,346

Index Scan using lawsuit_clients_history_client_lawsuit_id_idx on lawsuit_clients_history lawsuit_clients_history_2 (cost=0.29..15.50 rows=1 width=38) (actual time=0.015..0.015 rows=0 loops=28,346)

  • Index Cond: (lawsuit_clients_history_1.client_lawsuit_id = client_lawsuit_id)
  • Filter: ((lawsuit_clients_history_1.client_lawsuit_history_id < client_lawsuit_history_id) AND (date_trunc('year'::text, lower(lawsuit_clients_history_1.sys_period)) = date_trunc('year'::text, lower(sys_period))) AND (date_trunc('month'::text, lower(lawsuit_clients_history_1.sys_period)) = date_trunc('month'::text, lower(sys_period))))
  • Rows Removed by Filter: 10