Consider using an Index on "code" in commerce_wishlist table

Created on 27 June 2024, 11 months ago
Updated 2 July 2024, 10 months ago

Problem/Motivation

New relic was reporting a spike of slow performant queries all relating to adding an item to a wishlist. The stack trace shows alot of entity loads/saves etc etc but what stood out was the use if the wishlist code to pluck data out of the DB. I noticed, that the "code" column isn't index. Out of the box, there are 6 indexes on the commerce_wishlist table, code not being one of them. After sticking an index in for "code" we noticed the performance of our wishlist queries increase 3 fold. So for a simple select query that WishlistStorage::loadByCode($code) performs, we saw query speeds of 441ms and after popping an index in, we got that time down to 0.1ms. A signifiance increase in speed!

Proposed resolution

A simple update hook that sticks an index on the "code" column. I will produce an MR after i've raised this issue.

โœจ Feature request
Status

Active

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom ChristianSanders

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024