New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance: validate_user_usage_limit() #8482

Closed
mikejolley opened this Issue Jun 29, 2015 · 7 comments

Comments

Projects
None yet
4 participants
@mikejolley
Member

mikejolley commented Jun 29, 2015

This was bought up in conversation with @pmgarman.

Issue is every time a coupon is used, a meta value is stored in _used_by. Coupons used hundreds of thousands of times cause issue on load.

We should look into a better way of storing this data.

@pmgarman

This comment has been minimized.

Contributor

pmgarman commented Jun 29, 2015

I posted in my dev blog a bit of background on how this can cripple a site in an edge case.

@ghost

This comment has been minimized.

ghost commented Jul 5, 2015

IMO use different table for that.

@pmgarman

This comment has been minimized.

Contributor

pmgarman commented Jul 5, 2015

That's my opinion as well

@mikejolley mikejolley added this to the 2.5 (name undecided) milestone Jul 6, 2015

@mikejolley

This comment has been minimized.

Member

mikejolley commented Aug 4, 2015

@georgestephanis georgestephanis self-assigned this Aug 4, 2015

@georgestephanis

This comment has been minimized.

Contributor

georgestephanis commented Aug 4, 2015

Having this stored as meta on the coupon also makes it difficult to track down what coupons a given user has used. Let me look into the schema and see what I can come up with.

@georgestephanis

This comment has been minimized.

Contributor

georgestephanis commented Aug 24, 2015

Okay, first swing at this completed:

When calling validate_user_usage_limit() -- we really don't need all the data for all usages, so I simplified the check in e6b7d5c

I also optimized some calls we're using in populate() with 6ef4cf0

Pull request generated as #8940

@mikejolley mikejolley modified the milestones: 2.5 (name undecided), Performance Audit Sep 9, 2015

mikejolley referenced this issue Sep 15, 2015

Merge pull request #8940 from woothemes/issues/8482
Tidy up how we're dealing with coupon postmeta around `_used_by` which can get big.
@pmgarman

This comment has been minimized.

Contributor

pmgarman commented Sep 15, 2015

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment