this may be somewhat of a noob question as I just started administering an ExpressionEngine site that uses CartThrob. My client complained of the site being slow during the shopping / checkout process so I enabled SQL profiling in EE to look into it.
I noticed something strange, which is that CartThrob is making many queries during each page load, far more than I would expect. Basically the page template uses
six times to show six different products. Then uses
within each one to pull some various information about the product. The strange thing is that a single SQL SELECT and another SQL UPDATE query seem to be running over and over again on the same page (each of them runs over 50 times on one page load).
SELECT `cart` FROM (`exp_cartthrob_cart`) WHERE `id` = '12345' LIMIT 1; UPDATE `exp_cartthrob_cart` SET `cart` = 'a-bunch-of-encoded-gibberish', `timestamp` = 1386624719, `url` = 'http://example.com/product-details' WHERE `id` = '12345';
Why would cartthrob be running these same queries over and over again, and how can I optimize this code to prevent it?