explain.depesz.com

PostgreSQL's explain analyze made readable

Result: eI3K

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.000 97.466 ↑ 12.5 16 1

Finalize GroupAggregate (cost=12,661.18..12,714.56 rows=200 width=31) (actual time=95.792..97.466 rows=16 loops=1)

  • Group Key: lawsuit_clients.stage, ((lower(lawsuit_clients.sys_period))::date)
2. 0.000 97.545 ↑ 8.0 45 1

Gather Merge (cost=12,661.18..12,707.94 rows=362 width=31) (actual time=95.265..97.545 rows=45 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 11.223 269.124 ↑ 12.1 15 3

Partial GroupAggregate (cost=11,661.16..11,666.13 rows=181 width=31) (actual time=87.167..89.708 rows=15 loops=3)

  • Group Key: lawsuit_clients.stage, ((lower(lawsuit_clients.sys_period))::date)
4. 23.760 257.901 ↓ 46.7 8,445 3

Sort (cost=11,661.16..11,661.61 rows=181 width=23) (actual time=85.322..85.967 rows=8,445 loops=3)

  • Sort Key: lawsuit_clients.stage, ((lower(lawsuit_clients.sys_period))::date) DESC
  • Sort Method: quicksort Memory: 773kB
5. 23.238 234.141 ↓ 46.7 8,445 3

Hash Join (cost=762.84..11,654.37 rows=181 width=23) (actual time=11.051..78.047 rows=8,445 loops=3)

  • Hash Cond: (lawsuit_clients.client_lawsuit_id = lb.client_lawsuit_id)
6. 2.667 178.476 ↓ 43.8 8,445 3

Append (cost=0.00..10,887.97 rows=193 width=48) (actual time=0.063..59.492 rows=8,445 loops=3)

7. 24.756 24.756 ↓ 4.5 189 3

Parallel Seq Scan on lawsuit_clients (cost=0.00..1,673.91 rows=42 width=41) (actual time=0.062..8.252 rows=189 loops=3)

  • Filter: (((status)::text = ANY ('{ATIVO,ENCERRADO}'::text[])) AND (value_cause_1a >= '0'::double precision) AND (value_cause_1a <= '5e+21'::double precision) AND (value_sentence >= '0'::double precision) AND (value_sentence <= '5e+21'::double precision) AND ((justice)::text = 'CÍVEL'::text) AND (lower(sys_period) >= '2018-08-01 00:00:00'::timestamp without time zone) AND (lower(sys_period) <= '2019-06-01 00:00:00'::timestamp without time zone) AND (lower(sys_period) >= '2019-01-01 00:00:00'::timestamp without time zone) AND (lower(sys_period) <= '2019-06-30 00:00:00'::timestamp without time zone))
  • Rows Removed by Filter: 5854
8. 151.053 151.053 ↓ 54.7 8,255 3

Parallel Seq Scan on lawsuit_clients_history (cost=0.00..9,214.06 rows=151 width=49) (actual time=29.281..50.351 rows=8,255 loops=3)

  • Filter: (((status)::text = ANY ('{ATIVO,ENCERRADO}'::text[])) AND (value_cause_1a >= '0'::double precision) AND (value_cause_1a <= '5e+21'::double precision) AND (value_sentence >= '0'::double precision) AND (value_sentence <= '5e+21'::double precision) AND ((justice)::text = 'CÍVEL'::text) AND (lower(sys_period) >= '2018-08-01 00:00:00'::timestamp without time zone) AND (lower(sys_period) <= '2019-06-01 00:00:00'::timestamp without time zone) AND (lower(sys_period) >= '2019-01-01 00:00:00'::timestamp without time zone) AND (lower(sys_period) <= '2019-06-30 00:00:00'::timestamp without time zone))
  • Rows Removed by Filter: 29168
9. 19.524 32.427 ↓ 1.0 18,130 3

Hash (cost=536.26..536.26 rows=18,126 width=4) (actual time=10.809..10.809 rows=18,130 loops=3)

  • Buckets: 32768 Batches: 1 Memory Usage: 894kB
10. 12.903 12.903 ↓ 1.0 18,130 3

Seq Scan on lawsuit_business lb (cost=0.00..536.26 rows=18,126 width=4) (actual time=0.013..4.301 rows=18,130 loops=3)

Planning time : 0.702 ms
Execution time : 97.654 ms