We have an install that is currently running Magento CE v1.5 (it has been upgraded over time, I think it started on approximately 1.1). The sales_flat_quote
table currently has upward of 550,000 rows in it. A large percentage of these have a null
customer_id
and are many months old. I can't think of a reason to keep them around, since they are old and not associated with a customer there is assumably no way anybody can ever get access to that quote again.
It seems strange that Magento doesn't seem to have a built in functionality for removing what seems like junk information (they do have a cron for removing quotes, but as far as I can tell, it only removes quotes that are set to is_active false, which as far as I can tell only happens when a quote is converted to an order).
Essentially, what I'm asking is... a.) Is it safe to delete these entries? b.) What is the best way of doing it (pure sql, via model, some option in the control panel I've missed, etc.)?
We've had several sites that needed the order information cleared after going from dev to production. We did it by truncating the sales_flat_*
and several other tables. We didn't have any problems with it. However, I recommend testing any direct database edits on a COPY of your database.
You can also delete records from sales_flat_quote
even if you don't delete the corresponding order records or other tables in sales_flat_*
. You should probably only delete records in the quote table that are more than 30 days old though, so that customers will have access to recent carts.
Here is a very helpful post from the Magento Commerce Forums. http://www.magentocommerce.com/boards/viewthread/1680/P405/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With