explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WjD7 : Optimization for: plan #xgHE - adds index on vendor_member.member_id

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.018 5,382.062 ↑ 349,364.0 1 1

Hash Join (cost=32,031.11..36,310.96 rows=349,364 width=4) (actual time=2,864.522..5,382.062 rows=1 loops=1)

  • Hash Cond: (employer.tenant_id = tenant.tenant_id)
2. 0.059 5,381.969 ↑ 349,364.0 1 1

Hash Join (cost=32,024.98..35,351.77 rows=349,364 width=8) (actual time=2,864.429..5,381.969 rows=1 loops=1)

  • Hash Cond: (member.employer_id = employer.employer_id)
3. 3,861.921 5,366.641 ↑ 381,654.0 1 1

Hash Right Join (cost=31,391.45..33,716.14 rows=381,654 width=8) (actual time=2,849.102..5,366.641 rows=1 loops=1)

  • Hash Cond: (vendor_member.member_id = member.id)
  • Filter: (((member.email)::text ~~* '%Elizabeth Aaron%'::text) OR (concat(member.first_name, ' ', member.last_name) ~~* '%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
4. 12.533 12.533 ↑ 1.0 110,312 1

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

5. 361.447 1,147.206 ↑ 1.0 762,440 1

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

  • Buckets: 1,048,576 Batches: 1 Memory Usage: 75,918kB
6. 785.759 785.759 ↑ 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.053..785.759 rows=762,440 loops=1)

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

SubPlan (for Hash Right Join)

8. 0.000 0.000 ↓ 0.0 0

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

9. 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)
10. 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))
11. 10.901 344.981 ↓ 0.0 0 1

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

  • Workers Planned: 2
  • Workers Launched: 2
12. 0.002 334.080 ↓ 0.0 0 3 / 3

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

13. 334.078 334.078 ↓ 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=334.078..334.078 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
14. 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)
15. 2.690 15.269 ↑ 1.0 15,169 1

Hash (cost=443.92..443.92 rows=15,169 width=8) (actual time=15.269..15.269 rows=15,169 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 721kB
16. 12.579 12.579 ↑ 1.0 15,169 1

Index Scan using uq_employer_tenant_id_wex_key on employer (cost=0.29..443.92 rows=15,169 width=8) (actual time=0.019..12.579 rows=15,169 loops=1)

  • Filter: (archived IS FALSE)
  • Rows Removed by Filter: 1,402
17. 0.015 0.075 ↑ 1.0 108 1

Hash (cost=4.78..4.78 rows=108 width=4) (actual time=0.075..0.075 rows=108 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
18. 0.060 0.060 ↑ 1.0 108 1

Index Only Scan using uq_tenant_tenant_id_wex_key on tenant (cost=0.14..4.78 rows=108 width=4) (actual time=0.010..0.060 rows=108 loops=1)

  • Heap Fetches: 108
Planning time : 4.426 ms
Execution time : 5,385.827 ms