What is safe to truncate from the Perch Shop database?

  • Hi,


    My Perch Shop tables have a huge amount of data, `shop_cart` for example has over a million rows. If I understand correctly, this table holds temp data whilst a customer is checking out. So is this data safe to truncate? It would probably be safer to remove everything apart from the last 50 entries just to be on the safe side.


    I'm just looking for conformation as to whether this is safe and in fact recommended?


    If that is, is there any other tables that would be safe to truncate on a regular basis to stop the database becoming too large. Should I even be worried about how large the database is?

  • It should be safe to clear the cart entries, as there are often a lot of empty carts. These are the queries we run to clean up the cart tables.


    SQL
    1. SELECT * FROM perch3_shop_cart WHERE memberID IS NULL AND customerID IS NULL AND cartTotalWithTax = "0.00" AND cartDiscountCode = "";
    2. SELECT * FROM perch3_shop_cart WHERE memberID IS NULL AND customerID IS NULL AND cartTotalWithTax = "0.00" AND cartDiscountCode = "" LIMIT 100000;
    3. DELETE FROM perch3_shop_cart WHERE memberID IS NULL AND customerID IS NULL AND cartTotalWithTax = "0.00" AND cartDiscountCode = "" LIMIT 100000;

    We limit to 100000 as otherwise it often crashes the database.


    As for other tables I'd be uncertain whether it would be safe to remove entries.