explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1teg : Optimization for: Optimization for: plan #wwUy; plan #nj17

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.002 5,726.068 ↑ 1.0 25 1

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

2. 43.648 5,726.066 ↑ 799.4 25 1

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

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

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

4. 129.006 4,383.541 ↓ 4.4 88,225 1

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

5. 125.860 1,935.855 ↓ 30.0 178,360 1

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

  • Group Key: reference3_.external_id
6. 1,136.578 1,809.995 ↓ 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.167..1,809.995 rows=279,200 loops=1)

  • Recheck Cond: (upper((reference)::text) ~~ '%201%'::text)
  • Rows Removed by Index Recheck: 1,235,548
  • Filter: (reference_type_id <> 0)
  • Rows Removed by Filter: 3,870
  • Heap Blocks: exact=27,921 lossy=26,540
7. 673.417 673.417 ↓ 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.417..673.417 rows=283,072 loops=1)

  • Index Cond: (upper((reference)::text) ~~ '%201%'::text)
8. 1,377.316 2,318.680 ↓ 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.013..0.013 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,235.150 1,235.150 ↑ 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.014 rows=1 loops=88,225)

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