explain.depesz.com

PostgreSQL's explain analyze made readable

Result: e3AZ : Optimization for: plan #bCCI

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.001 5,899.009 ↑ 1.0 25 1

Limit (cost=241,288.78..241,288.84 rows=25 width=41) (actual time=5,899.007..5,899.009 rows=25 loops=1)

2. 44.910 5,899.008 ↑ 799.4 25 1

Sort (cost=241,288.78..241,338.74 rows=19,986 width=41) (actual time=5,899.007..5,899.008 rows=25 loops=1)

  • Sort Key: references1_.reference_sortable, case0_.reception_date DESC, case0_.id DESC
  • Sort Method: top-N heapsort Memory: 26kB
3. 0.000 5,854.098 ↓ 4.4 88,318 1

Nested Loop Left Join (cost=94,870.80..240,724.79 rows=19,986 width=41) (actual time=1,990.134..5,854.098 rows=88,318 loops=1)

4. 0.000 4,537.309 ↓ 4.4 88,225 1

Nested Loop (cost=94,870.37..154,313.58 rows=19,986 width=16) (actual time=1,990.087..4,537.309 rows=88,225 loops=1)

5. 136.225 2,041.591 ↓ 30.0 178,360 1

HashAggregate (cost=94,869.94..94,929.36 rows=5,942 width=8) (actual time=1,989.910..2,041.591 rows=178,360 loops=1)

  • Group Key: reference3_.external_id
6. 1,231.923 1,905.366 ↓ 1.9 279,200 1

Bitmap Heap Scan on reference_t reference3_ (cost=10,072.20..94,497.87 rows=148,829 width=8) (actual time=677.144..1,905.366 rows=279,200 loops=1)

  • Recheck Cond: (upper((reference)::text) ~~ '%201%'::text)
  • Rows Removed by Index Recheck: 1235548
  • Filter: (reference_type_id <> 0)
  • Rows Removed by Filter: 3870
  • Heap Blocks: exact=27921 lossy=26540
7. 673.443 673.443 ↓ 1.6 283,072 1

Bitmap Index Scan on reference_upper_gist_idx (cost=0.00..10,034.99 rows=175,810 width=0) (actual time=673.443..673.443 rows=283,072 loops=1)

  • Index Cond: (upper((reference)::text) ~~ '%201%'::text)
8. 1,555.676 2,497.040 ↓ 0.0 0 178,360

Index Scan using pk_case_t on case_t case0_ (cost=0.42..9.98 rows=1 width=16) (actual time=0.014..0.014 rows=0 loops=178,360)

  • Index Cond: (id = reference3_.external_id)
  • Filter: ((NOT a_new_version_exists) AND ((case_type)::text <> 'UTG'::text) AND (reception_date >= '2010-01-06 00:00:00'::timestamp without time zone) AND (reception_date <= '2020-01-06 00:00:00'::timestamp without time zone) AND ( (...)
  • Rows Removed by Filter: 0
9.          

SubPlan (for Index Scan)

10. 941.364 941.364 ↑ 1.5 2 156,894

Index Scan using case_actor_authority_case_idx on case_actor_authority_t actors2_ (cost=0.43..8.65 rows=3 width=8) (actual time=0.006..0.006 rows=2 loops=156,894)

  • Index Cond: (case0_.id = case_id)
11. 1,323.375 1,323.375 ↑ 3.0 1 88,225

Index Scan using reference_case_idx on reference_t references1_ (cost=0.43..4.29 rows=3 width=33) (actual time=0.014..0.015 rows=1 loops=88,225)

  • Index Cond: ((case0_.id = external_id) AND (reference_type_id = 38))
Planning time : 0.940 ms
Execution time : 5,900.884 ms