Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Ecommerce Performance | CartId in OnlineShopOrder is not indexed in query table #5477
On loading carts, in Pimcore 5.8 there are several verifications, if an order already is assigned to the cart. A slow query log analysis showed that the associated SQL query does not utilize any SQL index. This may cause one (or several) full scans of the OnlineShopOrder query table per cart retrieval.
The following query does not use an index:
SELECT object_EF_OSO.o_id as o_id, `object_EF_OSO`.`o_type` FROM `object_EF_OSO` WHERE ((cartId = 'AppBundle\\Ecommerce\\CartManager\\Cart_2596' AND object_EF_OSO.o_type IN ('object','folder')) AND object_EF_OSO.o_published = 1);
The field is marked as
Pimcore does not throw this error, as exceptions on index updates are suppressed.
Setting the column length to "75" resolves the issue and will suffice in most cases. Typically namespaces to not exceed this length. Probably it is sufficient to update the class definition in Pimcore and add an alter statement to the migrations?
A long term solution may include that only the actual cartId (numeric value) is saved in the OnlineShopOrder object, not the entire namespace.