explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KLXs : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #xgHE - adds index on vendor_member.member_id; plan #WjD7; plan #Up22; plan #DYvS; plan #Uxnd; plan #bt9D; plan #cq1d; plan #riv; plan #GGAg; plan #j9yv; plan #obNc; plan #Q829; plan #cLJV; plan #KQub; plan #4o68; plan #kqii; plan #1vQo; plan #yBWv

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.005 4,809.055 ↑ 31,392.0 1 1

Nested Loop (cost=31,579.98..35,221.70 rows=31,392 width=4) (actual time=2,496.835..4,809.055 rows=1 loops=1)

2. 0.064 0.064 ↑ 1.0 1 1

Index Only Scan using uq_tenant_tenant_id_wex_key on tenant (cost=0.14..1.16 rows=1 width=4) (actual time=0.019..0.064 rows=1 loops=1)

  • Index Cond: (tenant_id = 40)
  • Heap Fetches: 1
3. 0.017 4,808.986 ↑ 31,392.0 1 1

Hash Join (cost=31,579.83..34,906.62 rows=31,392 width=8) (actual time=2,496.812..4,808.986 rows=1 loops=1)

  • Hash Cond: (member.employer_id = employer.employer_id)
4. 3,457.664 4,807.049 ↑ 381,654.0 1 1

Hash Right Join (cost=31,391.45..33,716.14 rows=381,654 width=8) (actual time=2,494.876..4,807.049 rows=1 loops=1)

  • Hash Cond: (vendor_member.member_id = member.id)
  • Filter: (((member.email)::text ~~* '%Elizabeth Aaron%'::text) OR ((((member.first_name)::text || ' '::text) || (member.last_name)::text) ~~* '%Elizabeth Aaron%'::text) OR ((member.first_name)::text ~~* '%Elizabeth Aaron%'::text) OR ((member.last_name)::text ~~* '%Elizabeth Aaron%'::text) OR ((member.alegeus_key)::text ~~* '%Elizabeth Aaron%'::text) OR ((member.datapath_key)::text ~~* '%Elizabeth Aaron%'::text) OR ((member.wex_key)::text ~~* '%Elizabeth Aaron%'::text) OR ((vendor_member.key)::text ~~* '%Elizabeth Aaron%'::text) OR ((member.ssn)::text ~~* '%Elizabeth Aaron%'::text) OR (alternatives: SubPlan 1 or hashed SubPlan 2) OR (((member.first_name)::text ~~* '%Elizabeth%'::text) AND ((member.last_name)::text ~~* '%Aaron%'::text)))
  • Rows Removed by Filter: 762,539
5. 12.238 12.238 ↑ 1.0 110,312 1

Seq Scan on vendor_member (cost=0.00..2,035.12 rows=110,312 width=11) (actual time=0.016..12.238 rows=110,312 loops=1)

6. 333.749 1,008.157 ↑ 1.0 762,440 1

Hash (cost=21,855.47..21,855.47 rows=762,878 width=80) (actual time=1,008.156..1,008.157 rows=762,440 loops=1)

  • Buckets: 1,048,576 Batches: 1 Memory Usage: 75,918kB
7. 674.408 674.408 ↑ 1.0 762,440 1

Index Scan using member_employer_id on member (cost=0.42..21,855.47 rows=762,878 width=80) (actual time=0.052..674.408 rows=762,440 loops=1)

  • Filter: ((deleted IS FALSE) AND (archived IS FALSE))
  • Rows Removed by Filter: 80,287
8.          

SubPlan (for Hash Right Join)

9. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.84..4.68 rows=1 width=0) (never executed)

10. 0.000 0.000 ↓ 0.0 0

Index Scan using member_policy_holder__member_id on member_policy_holder (cost=0.42..1.71 rows=2 width=4) (never executed)

  • Index Cond: (member.id = member_id)
11. 0.000 0.000 ↓ 0.0 0

Index Scan using policy_holder_pkey on policy_holder (cost=0.42..1.45 rows=1 width=4) (never executed)

  • Index Cond: (policy_holder_id = member_policy_holder.policy_holder_id)
  • Filter: (((first_name)::text ~~* '%Elizabeth Aaron%'::text) OR ((last_name)::text ~~* '%Elizabeth Aaron%'::text) OR ((username)::text ~~* '%Elizabeth Aaron%'::text) OR ((email)::text ~~* '%Elizabeth Aaron%'::text))
12. 11.675 328.990 ↓ 0.0 0 1

Gather (cost=1,000.84..6,055.18 rows=26 width=4) (actual time=328.867..328.990 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
13. 0.002 317.315 ↓ 0.0 0 3 / 3

Nested Loop (cost=0.84..5,052.58 rows=11 width=4) (actual time=317.315..317.315 rows=0 loops=3)

14. 317.313 317.313 ↓ 0.0 0 3 / 3

Parallel Index Scan using policy_holder_pkey on policy_holder policy_holder_1 (cost=0.42..5,036.66 rows=11 width=4) (actual time=317.313..317.313 rows=0 loops=3)

  • Filter: (((first_name)::text ~~* '%Elizabeth Aaron%'::text) OR ((last_name)::text ~~* '%Elizabeth Aaron%'::text) OR ((username)::text ~~* '%Elizabeth Aaron%'::text) OR ((email)::text ~~* '%Elizabeth Aaron%'::text))
  • Rows Removed by Filter: 56,277
15. 0.000 0.000 ↓ 0.0 0 / 3

Index Scan using member_policy_holder__policy_holder_id on member_policy_holder member_policy_holder_1 (cost=0.42..1.44 rows=1 width=8) (never executed)

  • Index Cond: (policy_holder_id = policy_holder_1.policy_holder_id)
16. 0.187 1.920 ↓ 1.1 1,485 1

Hash (cost=171.35..171.35 rows=1,363 width=8) (actual time=1.920..1.920 rows=1,485 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 75kB
17. 1.733 1.733 ↓ 1.1 1,485 1

Index Scan using uq_employer_tenant_id_wex_key on employer (cost=0.29..171.35 rows=1,363 width=8) (actual time=0.019..1.733 rows=1,485 loops=1)

  • Index Cond: (tenant_id = 40)
  • Filter: (archived IS FALSE)
  • Rows Removed by Filter: 4
Planning time : 8.864 ms
Execution time : 4,810.818 ms