explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CC6A

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.022 26,875.066 ↑ 1.0 1 1

Aggregate (cost=55,154.09..55,154.10 rows=1 width=8) (actual time=26,875.066..26,875.066 rows=1 loops=1)

2. 0.005 26,875.044 ↑ 593.6 19 1

Append (cost=0.00..55,125.89 rows=11,278 width=8) (actual time=20,088.201..26,875.044 rows=19 loops=1)

3. 0.000 0.002 ↓ 0.0 0 1

Seq Scan on action_history action0_ (cost=0.00..0.00 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=1)

  • Filter: (((type)::text = ANY ('{ACCOUNTS_MANAGEMENT,LINK_MANAGEMENT,DELEGATION_MANAGEMENT}'::text[])) AND ((action_date)::date >= '2020-09-09'::date) AND ((action_date)::date <= '2020-09-12'::date) AND ((((actor_type)::text = 'USER'::text) AND ((authenticate_as = '2127980'::bigint) OR (user_id = '2127980'::bigint))) OR (((type)::text = 'LINK_MANAGEMENT'::text) AND (alternatives: SubPlan 1 or hashed SubPlan 2)) OR (((type)::text = 'ACCOUNTS_MANAGEMENT'::text) AND (entity = '2127980'::bigint))))
4.          

SubPlan (for Seq Scan)

5. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_provider_link_user_id_provider_id on provider_link providerli1_ (cost=0.43..1.05 rows=1 width=0) (never executed)

  • Index Cond: (user_id = '2127980'::bigint)
  • Filter: (id = action0_.entity)
6. 0.024 0.024 ↑ 1.0 1 1

Index Scan using idx_provider_link_user_id_provider_id on provider_link providerli1__1 (cost=0.43..1.05 rows=1 width=8) (actual time=0.024..0.024 rows=1 loops=1)

  • Index Cond: (user_id = '2127980'::bigint)
7. 22,107.991 26,875.037 ↑ 593.5 19 1

Bitmap Heap Scan on action_history_2020_09 action0__1 (cost=24,627.98..55,125.89 rows=11,277 width=8) (actual time=20,088.199..26,875.037 rows=19 loops=1)

  • Recheck Cond: ((((authenticate_as = '2127980'::bigint) OR (user_id = '2127980'::bigint)) OR (((type)::text = 'LINK_MANAGEMENT'::text) AND ((type)::text = ANY ('{ACCOUNTS_MANAGEMENT,LINK_MANAGEMENT,DELEGATION_MANAGEMENT}'::text[]))) OR (entity = '2127980'::bigint)) AND ((action_date)::date >= '2020-09-09'::date) AND ((action_date)::date <= '2020-09-12'::date))
  • Filter: (((type)::text = ANY ('{ACCOUNTS_MANAGEMENT,LINK_MANAGEMENT,DELEGATION_MANAGEMENT}'::text[])) AND ((((actor_type)::text = 'USER'::text) AND ((authenticate_as = '2127980'::bigint) OR (user_id = '2127980'::bigint))) OR (((type)::text = 'LINK_MANAGEMENT'::text) AND (alternatives: SubPlan 1 or hashed SubPlan 2)) OR (((type)::text = 'ACCOUNTS_MANAGEMENT'::text) AND (entity = '2127980'::bigint))))
  • Rows Removed by Filter: 73,165
  • Heap Blocks: exact=49,789
8. 39.368 4,767.046 ↓ 0.0 0 1

BitmapAnd (cost=24,627.98..24,627.98 rows=22,606 width=0) (actual time=4,767.046..4,767.046 rows=0 loops=1)

9. 0.001 498.120 ↓ 0.0 0 1

BitmapOr (cost=808.38..808.38 rows=67,474 width=0) (actual time=498.120..498.120 rows=0 loops=1)

10. 0.001 0.464 ↓ 0.0 0 1

BitmapOr (cost=8.83..8.83 rows=230 width=0) (actual time=0.464..0.464 rows=0 loops=1)

11. 0.444 0.444 ↓ 0.0 0 1

Bitmap Index Scan on idx_action_history_2020_09_authenticate_as (cost=0.00..2.24 rows=201 width=0) (actual time=0.444..0.444 rows=0 loops=1)

  • Index Cond: (authenticate_as = '2127980'::bigint)
12. 0.019 0.019 ↑ 1.5 19 1

Bitmap Index Scan on idx_action_history_2020_09_user_id (cost=0.00..0.95 rows=29 width=0) (actual time=0.019..0.019 rows=19 loops=1)

  • Index Cond: (user_id = '2127980'::bigint)
13. 497.631 497.631 ↓ 2.7 181,820 1

Bitmap Index Scan on idx_action_history_2020_09_type (cost=0.00..793.07 rows=67,229 width=0) (actual time=497.631..497.631 rows=181,820 loops=1)

  • Index Cond: (((type)::text = 'LINK_MANAGEMENT'::text) AND ((type)::text = ANY ('{ACCOUNTS_MANAGEMENT,LINK_MANAGEMENT,DELEGATION_MANAGEMENT}'::text[])))
14. 0.024 0.024 ↑ 1.7 9 1

Bitmap Index Scan on idx_action_history_2020_09_entity (cost=0.00..0.84 rows=15 width=0) (actual time=0.024..0.024 rows=9 loops=1)

  • Index Cond: (entity = '2127980'::bigint)
15. 4,229.558 4,229.558 ↓ 1.1 2,229,669 1

Bitmap Index Scan on idx_action_history_2020_09_date_type (cost=0.00..23,816.53 rows=2,019,617 width=0) (actual time=4,229.558..4,229.558 rows=2,229,669 loops=1)

  • Index Cond: (((action_date)::date >= '2020-09-09'::date) AND ((action_date)::date <= '2020-09-12'::date))