<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Data-Diggers.com &#187; Performance</title>
	<atom:link href="http://www.data-diggers.com/index.php/category/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.data-diggers.com</link>
	<description>Zen Cart Optimization, Performance and A/B Split Testing Modules for Zen Cart</description>
	<lastBuildDate>Mon, 26 Sep 2011 15:21:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>TruboImages ReleaseCandidate &#8211; volounteers needed.</title>
		<link>http://www.data-diggers.com/index.php/2011/01/truboimages-releasecandidate-volounteers-needed/</link>
		<comments>http://www.data-diggers.com/index.php/2011/01/truboimages-releasecandidate-volounteers-needed/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 19:20:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Utils]]></category>
		<category><![CDATA[Speed]]></category>
		<category><![CDATA[TurboImages]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.data-diggers.com/?p=330</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2011%2F01%2Ftruboimages-releasecandidate-volounteers-needed%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2011%2F01%2Ftruboimages-releasecandidate-volounteers-needed%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">I&#8217;ve created module that spreads images over given number of subdomains on store. It greatly speeds up page loading times, gives better performance score in Google Page Speed and Yahoo YSlow. I&#8217;m not completely sure, but it should also affect SEO due to not-so-recent Google decision to take into account page speed.</p>
<p>I think it is great way to speed up any Zen Cart store which contains lots of images.</p>
<p>Here&#8217;s simple overview of what the module does.<br />
It changes all urls of images on Your store from:</p>
<p>http://www.mydomain.com/images/products/my_product.jpg</p>
<p>http://www.mydomain.com/images/products/my_product2.jpg</p>
<p>http://www.mydomain.com/images/products/my_product3.jpg</p>
<p>to</p>
<p>http://www.img1.mydomain.com/images/products/my_product.jpg</p>
<p>http://www.img2.mydomain.com/images/products</p>
<p>http://www.img3.mydomain.com/images/products/my_product.jpg/my_product.jpg</p>
<p>It&#8217;s done automatically, no manual mapping &lt;imgX,subdomainY&gt; is needed.</p>
<p>Unfortunately the module isn&#8217;t yet completely finished and I don&#8217;t have time to test it completely. I&#8217;m looking for volunteers for &#8216;Release Candidate&#8217; quality installation. I&#8217;ll guide You with installation and provide support, or I may install the module myself.</p>
<p>Anyone interested in participating in tests please either PM on zen-cart.com or send me email via www.data-diggers.com. Please keep in mind that You must be able to create subdomains  for Your domain.</p>
<p>Regards,<br />
Data-Digger.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2011/01/truboimages-releasecandidate-volounteers-needed/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>QueryCache v1.7 Beta for ZenCart 1.3.9h is available</title>
		<link>http://www.data-diggers.com/index.php/2011/01/querycache-v1-7-beta-for-zencart-1-3-9h-is-available/</link>
		<comments>http://www.data-diggers.com/index.php/2011/01/querycache-v1-7-beta-for-zencart-1-3-9h-is-available/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 18:53:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Query Cache]]></category>

		<guid isPermaLink="false">http://www.data-diggers.com/?p=324</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2011%2F01%2Fquerycache-v1-7-beta-for-zencart-1-3-9h-is-available%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2011%2F01%2Fquerycache-v1-7-beta-for-zencart-1-3-9h-is-available%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Yes, finally! I&#8217;m sorry it took so long. You can download it from:</p>
<p style="text-align: center;"><a title="QueryCache v1.7-beta for Zen Cart v1.3.9h" href="http://www.data-diggers.com/contribs/query-cache/downloads/querycache-V1.7-beta.zip"><strong>Query Cache v1.7-beta</strong></a></p>
<p>Installation instructions are in .zip file. Currently the package is released as <span style="text-decoration: underline;"><strong>beta</strong></span>. Please report any bugs either via email or below in comments.</p>
<p>Changes:</p>
<ul>
<li>Works with Zen Cart 1.3.9h</li>
<li>Few memory tweaks</li>
<li>Few bug fixes</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2011/01/querycache-v1-7-beta-for-zencart-1-3-9h-is-available/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Request to Query Cache users</title>
		<link>http://www.data-diggers.com/index.php/2010/02/request-to-query-cache-users/</link>
		<comments>http://www.data-diggers.com/index.php/2010/02/request-to-query-cache-users/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 14:24:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Query Cache]]></category>

		<guid isPermaLink="false">http://www.data-diggers.com/?p=203</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2010%2F02%2Frequest-to-query-cache-users%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2010%2F02%2Frequest-to-query-cache-users%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">I promised to release new, more memory efficient version of Query Cache soon  &#8211; unfortunately (or fortunately) it seems that PHP is quite good at managing memory and there&#8217;s not much to improve. Therefore version 1.7 of Query Cache will be delayed.</p>
<p style="text-align: justify;"><strong>Request to Query Cache users:</strong></p>
<p style="text-align: justify;">If You use Query Cache and Your store is still slow <span style="text-decoration: underline;">and it&#8217;s not related to search script</span> please contact me either on email, PM on Zen-Cart.com (data_digger) or by leaving comment. I&#8217;ll check Your site and try to make necessary changes in Query Cache v1.7 for You.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2010/02/request-to-query-cache-users/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Speed up admin/orders.php page</title>
		<link>http://www.data-diggers.com/index.php/2009/06/speed-up-adminorders-php-page/</link>
		<comments>http://www.data-diggers.com/index.php/2009/06/speed-up-adminorders-php-page/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 05:38:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.data-diggers.eu/?p=62</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F06%2Fspeed-up-adminorders-php-page%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F06%2Fspeed-up-adminorders-php-page%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">There&#8217;s suboptimal query in admin/orders.php page which retrieves information about last orders. Unfortunately query is constructed in such way that MySQL scans whole orders, orders_products and orders_total table. As always it&#8217;s not a problem until orders table gets big ( for example 50 000 entries ). If You happen to have at least 10 000 orders ( I wish You that <img src='http://www.data-diggers.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ), You probably get impatient each time You request admin/orders.php page.</p>
<p style="text-align: justify;">Good news is that there is quick fix. Just add index on (orders_id, class) on orders_total table to speed up the query. Here&#8217;s MySQL statement which does that for You:</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">ALTER</span> <span class="kw1">TABLE</span> orders_total <span class="kw1">ADD</span> <span class="kw1">INDEX</span> idx_oid_class<span class="br0">&#40;</span>orders_id<span class="sy0">,</span> class<span class="br0">&#41;</span></div>
</div>
</div>
<p style="text-align: justify;">The query is still suboptimal, but at least its quite fast until orders table gets really big (500 000 orders? It&#8217;ll depend on Your server).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2009/06/speed-up-adminorders-php-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Performance issues with Store Credit Module in admin area</title>
		<link>http://www.data-diggers.com/index.php/2009/06/performance-issues-with-store-credit-module-in-admin-area/</link>
		<comments>http://www.data-diggers.com/index.php/2009/06/performance-issues-with-store-credit-module-in-admin-area/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 13:34:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[store credit]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.data-diggers.eu/?p=55</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F06%2Fperformance-issues-with-store-credit-module-in-admin-area%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F06%2Fperformance-issues-with-store-credit-module-in-admin-area%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;"><strong>Store Credit</strong> is great module, unfortunately it&#8217;s preety inefecient in some places. For example, on every page request of<em> admin/store_credit.php</em> whole customers table is read, and for each customer additional SELECT and UPDATE query is executed to calculate and update pending points, even if the customer does not have any pending points!</p>
<p style="text-align: justify;">It&#8217;s not a big deal when You have up to 1000 customers, but when there are more then 100 000 customers page loads in 30 seconds (store_credit.php executes over 2 x customer count,  or in this example over 200 000 queries on each request).</p>
<p style="text-align: justify;">To address that, change following code in admin/store_credit.php:</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">function</span> store_pending_rewards<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">global</span> <span class="re0">$db</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$customers</span> <span class="sy0">=</span> <span class="re0">$db</span><span class="sy0">-&gt;</span><span class="me1">Execute</span><span class="br0">&#40;</span><span class="st0">&quot;SELECT customers_id FROM &quot;</span> <span class="sy0">.</span> TABLE_CUSTOMERS <span class="sy0">.</span> <span class="st0">&quot; ORDER BY customers_id ASC&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="re0">$customers</span><span class="sy0">-&gt;</span><span class="me1">EOF</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$customers_id</span> <span class="sy0">=</span> <span class="re0">$customers</span><span class="sy0">-&gt;</span><span class="me1">fields</span><span class="br0">&#91;</span><span class="st_h">&#8216;customers_id&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$pending_rewards</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">get_pending_rewards</span><span class="br0">&#40;</span><span class="re0">$customers_id</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$db</span><span class="sy0">-&gt;</span><span class="me1">Execute</span><span class="br0">&#40;</span><span class="st0">&quot;UPDATE &quot;</span> <span class="sy0">.</span> TABLE_STORE_CREDIT <span class="sy0">.</span> <span class="st0">&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SET pending = &quot;</span> <span class="sy0">.</span> <span class="re0">$pending_rewards</span> <span class="sy0">.</span> <span class="st0">&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE customers_id = &quot;</span> <span class="sy0">.</span> <span class="re0">$customers_id</span> <span class="sy0">.</span> <span class="st0">&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LIMIT 1&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$customers</span><span class="sy0">-&gt;</span><span class="me1">MoveNext</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
</div>
<p style="text-align: justify;">to:</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;"><span class="kw2">function</span> store_pending_rewards<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">global</span> <span class="re0">$db</span><span class="sy0">;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$customers</span> <span class="sy0">=</span> <span class="re0">$db</span><span class="sy0">-&gt;</span><span class="me1">Execute</span><span class="br0">&#40;</span><span class="st0">&quot;SELECT DISTINCT customers_id FROM &quot;</span> <span class="sy0">.</span> TABLE_SC_REWARD_POINT_LOGS <span class="sy0">.</span> <span class="st0">&quot; ORDER BY customers_id ASC&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="re0">$customers</span><span class="sy0">-&gt;</span><span class="me1">EOF</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$customers_id</span> <span class="sy0">=</span> <span class="re0">$customers</span><span class="sy0">-&gt;</span><span class="me1">fields</span><span class="br0">&#91;</span><span class="st_h">&#8216;customers_id&#8217;</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$pending_rewards</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">get_pending_rewards</span><span class="br0">&#40;</span><span class="re0">$customers_id</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$pending_rewards</span> <span class="sy0">==</span> 0<span class="sy0">.</span>0<span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="re0">$customers</span><span class="sy0">-&gt;</span><span class="me1">MoveNext</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="kw1">continue</span><span class="sy0">;</span> <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$db</span><span class="sy0">-&gt;</span><span class="me1">Execute</span><span class="br0">&#40;</span><span class="st0">&quot;UPDATE &quot;</span> <span class="sy0">.</span> TABLE_STORE_CREDIT <span class="sy0">.</span> <span class="st0">&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SET pending = &quot;</span> <span class="sy0">.</span> <span class="re0">$pending_rewards</span> <span class="sy0">.</span> <span class="st0">&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE customers_id = &quot;</span> <span class="sy0">.</span> <span class="re0">$customers_id</span> <span class="sy0">.</span> <span class="st0">&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LIMIT 1&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$customers</span><span class="sy0">-&gt;</span><span class="me1">MoveNext</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
</div>
<p style="text-align: justify;">Thanks to that, only customers who actually have some pending points will be processed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2009/06/performance-issues-with-store-credit-module-in-admin-area/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Query Log v1.5.1 released</title>
		<link>http://www.data-diggers.com/index.php/2009/06/query-log-v1-5-1-released/</link>
		<comments>http://www.data-diggers.com/index.php/2009/06/query-log-v1-5-1-released/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 10:14:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Query Log]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.data-diggers.eu/?p=51</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F06%2Fquery-log-v1-5-1-released%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F06%2Fquery-log-v1-5-1-released%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">Version v1.5.1 of<strong> Query Log </strong>is available. You can download it from: <a href="http://www.data-diggers.com/contribs/query-log/downloads/querylog-current.zip">www.data-diggers.com/contribs/query-log/downloads/querylog-current.zip</a> .</p>
<h2 style="text-align: justify;">What&#8217;s new in this version:</h2>
<ul style="text-align: justify;">
<li>You can now close &#8216;calculator&#8217; layer (it&#8217;s the tool that highlights queries that match given regular expression)</li>
<li>You can now disable query logging completely. In previous versions Query Log kept all queries in memory, no matter if You wanted to log them (display them) or not.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2009/06/query-log-v1-5-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speed up &#8216;Order history&#8217; query by 50%-75%</title>
		<link>http://www.data-diggers.com/index.php/2009/06/speed-up-order-history-query-by-50-75/</link>
		<comments>http://www.data-diggers.com/index.php/2009/06/speed-up-order-history-query-by-50-75/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 14:46:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.data-diggers.eu/?p=49</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F06%2Fspeed-up-order-history-query-by-50-75%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F06%2Fspeed-up-order-history-query-by-50-75%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">I noticed that following query takes long time to execute:</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">SELECT</span> <span class="kw1">DISTINCT</span> op<span class="sy0">.</span>products_id<br />
<span class="kw1">FROM</span> orders o<span class="sy0">,</span> orders_products op<span class="sy0">,</span> products p<br />
<span class="kw1">WHERE</span> o<span class="sy0">.</span>customers_id <span class="sy0">=</span> <span class="st0">&#8217;2345&#8242;</span><br />
<span class="kw1">AND</span> o<span class="sy0">.</span>orders_id <span class="sy0">=</span> op<span class="sy0">.</span>orders_id<br />
<span class="kw1">AND</span> op<span class="sy0">.</span>products_id <span class="sy0">=</span> p<span class="sy0">.</span>products_id<br />
<span class="kw1">AND</span> p<span class="sy0">.</span>products_status <span class="sy0">=</span> <span class="st0">&#8217;1&#8242;</span><br />
<span class="kw1">GROUP</span> <span class="kw1">BY</span> products_id<br />
<span class="kw1">ORDER</span> <span class="kw1">BY</span> o<span class="sy0">.</span>date_purchased <span class="kw1">DESC</span><br />
<span class="kw1">LIMIT</span> <span class="nu0">6</span></div>
</div>
</div>
<p style="text-align: justify;">I noticed that there&#8217;s no index on <strong>orders </strong>table on <strong><em>customers_id</em></strong> field. Without it MySQL has to scan whole table to find orders by <strong><em>customers_id</em></strong><em> </em>(in this case &#8217;2345&#8242;). If <strong>orders </strong>table is small there&#8217;s no problem, but when it has 10 000 or more entries it can noticably slow down Zen Cart. So, let&#8217;s add index on that table</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">ALTER</span> <span class="kw1">TABLE</span> <span class="st0">`orders`</span> <span class="kw1">ADD</span> <span class="kw1">INDEX</span> <span class="st0">`idx_cid_datepurchased`</span><span class="br0">&#40;</span><span class="st0">`customers_id`</span><span class="sy0">,</span> <span class="st0">`date_purchased`</span><span class="br0">&#41;</span>;</div>
</div>
</div>
<p style="text-align: justify;">I included <strong><em>date_purchased</em></strong> in index, because some pages in admin area will use it for searching all orders of given customer.</p>
<p style="text-align: justify;">In my case it decreased query time from 0.3 sec to 0.08 sec. It&#8217;s still too much, but it&#8217;s better then nothing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2009/06/speed-up-order-history-query-by-50-75/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Query Cache v1.6 released</title>
		<link>http://www.data-diggers.com/index.php/2009/01/query-cache-v1-6-released/</link>
		<comments>http://www.data-diggers.com/index.php/2009/01/query-cache-v1-6-released/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 22:38:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Query Cache]]></category>

		<guid isPermaLink="false">http://www.data-diggers.eu/?p=41</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F01%2Fquery-cache-v1-6-released%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F01%2Fquery-cache-v1-6-released%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">New version of<strong> Query Cache</strong> is available. If You have lots of categories in Your store, this release is a must. Download new version <a href="http://www.data-diggers.com/contribs/query-cache/downloads/querycache-current.zip"><strong>here</strong></a>. Version 1.6 adds following features:</p>
<ul style="text-align: justify;">
<li>Option to prefetch products_to_categories table for faster execution of zen_get_categories_products_list() function. You can turn ON/OFF this functionality by changing QC_ZEN_GET_CATEGORIES_PRODUCTS_LIST_PREFETCH switch in includes/extra_configures/query_cache.php. If Your store executes thousands of queries it&#8217;s pretty good chance that this option will solve it.</li>
<li>Query Cache can now work in Admin area too. Just enable QC_ENABLE_IN_ADMIN in admin/includes//extra_configures/query_cache.php.</li>
</ul>
<p style="text-align: justify;">By default new switches are set to false. If You have many (at least few hundreds) products linked to many categories prefetching products_to_categories table will probably improve performance. On one store this switch managed to reduce query count from 15 000 queries ( yes, 15 thousands queries!) to about 100 queries (<strong><span style="text-decoration: underline;">99,3% less queries!</span></strong>).</p>
<p style="text-align: justify;">If You&#8217;ll find any bugs, please report back.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2009/01/query-cache-v1-6-released/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Query Cache v1.5 released</title>
		<link>http://www.data-diggers.com/index.php/2009/01/query-cache-v1-5-released/</link>
		<comments>http://www.data-diggers.com/index.php/2009/01/query-cache-v1-5-released/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 14:24:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Query Cache]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.data-diggers.eu/?p=37</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F01%2Fquery-cache-v1-5-released%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F01%2Fquery-cache-v1-5-released%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">Version 1.5 of<strong> Query Cache</strong> for Zen Cart has been released. New version <strong>reduces query count by 80%</strong> (previous version reduced query count by &#8216;only&#8217; 50%). Here&#8217;s list of changes:</p>
<ul style="text-align: justify;">
<li>970 queries down to 198 queries ( v1.0 executed about 450 queries )</li>
<li>some performance improvements to code</li>
<li>includes/functions/functions_categories.php has been rewritten to use cache and prefetch data. It reduces query count by about 100 queries (it depends on number of categories in Your store)</li>
<li>basic queries for product from products table (for example &#8220;<em>select products_name, manufacturers_id from products where products_id = &#8217;7&#8242;</em>&#8220;) can now be rewritten to &#8220;<em>select * from products where products_id = &#8217;7&#8242;</em>&#8220;. It saves about 100 queries on default Zen Cart demo store.<strong><br />
</strong></li>
</ul>
<p style="text-align: justify;">Download <a href="http://www.data-diggers.com/contribs/query-cache/downloads/querycache-current.zip">Query Cache v1.5</a>. See <a href="http://www.data-diggers.eu/index.php/2008/12/query-cache-for-zen-cart-released/">updated blog entry on Query Cache</a> for updated charts, demo stores and screencast.</p>
<h2 style="text-align: justify;"><strong>Stay in touch<br />
</strong></h2>
<p style="text-align: justify;">Just type Your address here to be notified of new versions of Query Cache (You&#8217;ll receive only updates on Query Cache). Quick info: We hate spam, Your email will not be given to anyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2009/01/query-cache-v1-5-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>InnoDB vs MyISAM performance in Zen Cart. Which is better?</title>
		<link>http://www.data-diggers.com/index.php/2009/01/innodb-vs-myisam-performance-in-zen-cart-which-is-better/</link>
		<comments>http://www.data-diggers.com/index.php/2009/01/innodb-vs-myisam-performance-in-zen-cart-which-is-better/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 13:36:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[innodb vs myisam]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.data-diggers.eu/?p=31</guid>
		<description><![CDATA[ ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F01%2Finnodb-vs-myisam-performance-in-zen-cart-which-is-better%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.data-diggers.com%2Findex.php%2F2009%2F01%2Finnodb-vs-myisam-performance-in-zen-cart-which-is-better%2F&amp;source=datadiggers&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">Zen Cart uses MyISAM tables to store data, but MySQL offers other storage engines too. Is MyISAM the best choice? Is it the fastest one? These questions will be answered.. right now: No, it isn&#8217;t (at least not always). Read below to find out more.</p>
<h2 style="text-align: justify;"><strong>Performance test</strong></h2>
<p style="text-align: justify;"><strong>Note</strong>: <em>In test We used MySQL 5.0.41. Results can vary depending on MySQL version You use.</em></p>
<p style="text-align: justify;">Let&#8217;s find out which of the two is faster. To do this We&#8217;ll need to test their performance. We created Java application which executes typical SELECT queries against Zen Cart demo store database and measures query performance. Here are some of those queries:</p>
<p style="text-align: justify;">SELECT queries</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">SELECT</span> SQL_NO_CACHE count<span class="br0">&#40;</span><span class="sy0">*</span><span class="br0">&#41;</span> <span class="kw1">AS</span> total<br />
<span class="kw1">FROM</span> products p<span class="sy0">,</span> products_to_categories p2c<br />
<span class="kw1">WHERE</span> p<span class="sy0">.</span>products_id <span class="sy0">=</span> p2c<span class="sy0">.</span>products_id<br />
<span class="kw1">AND</span> p<span class="sy0">.</span>products_status <span class="sy0">=</span> <span class="st0">&#8217;1&#8242;</span><br />
<span class="kw1">AND</span> p2c<span class="sy0">.</span>categories_id <span class="sy0">=</span> <span class="st0">&#8217;22&#8242;</span></div>
</div>
</div>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">SELECT</span> SQL_NO_CACHE products_type<br />
<span class="kw1">FROM</span> products<br />
<span class="kw1">WHERE</span> products_id <span class="sy0">=</span> <span class="st0">&#8217;12&#8242;</span></div>
</div>
</div>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">SELECT</span> SQL_NO_CACHE <span class="kw1">DISTINCT</span> p<span class="sy0">.</span>products_id<span class="sy0">,</span> p<span class="sy0">.</span>products_image<span class="sy0">,</span> pd<span class="sy0">.</span>products_name<span class="sy0">,</span> p<span class="sy0">.</span>master_categories_id<br />
<span class="kw1">FROM</span> <span class="br0">&#40;</span>products p<br />
<span class="kw1">LEFT</span> <span class="kw1">JOIN</span> featured f <span class="kw1">ON</span> p<span class="sy0">.</span>products_id <span class="sy0">=</span> f<span class="sy0">.</span>products_id<br />
<span class="kw1">LEFT</span> <span class="kw1">JOIN</span> products_description pd <span class="kw1">ON</span> p<span class="sy0">.</span>products_id <span class="sy0">=</span> pd<span class="sy0">.</span>products_id <span class="br0">&#41;</span><br />
<span class="kw1">WHERE</span> p<span class="sy0">.</span>products_id <span class="sy0">=</span> f<span class="sy0">.</span>products_id<br />
<span class="kw1">AND</span> p<span class="sy0">.</span>products_id <span class="sy0">=</span> pd<span class="sy0">.</span>products_id<br />
<span class="kw1">AND</span> p<span class="sy0">.</span>products_status <span class="sy0">=</span> 1 <span class="kw1">AND</span> f<span class="sy0">.</span><span class="kw1">STATUS</span> <span class="sy0">=</span> 1<br />
<span class="kw1">AND</span> pd<span class="sy0">.</span>language_id <span class="sy0">=</span> <span class="st0">&#8217;1&#8242;</span></div>
</div>
</div>
<p style="text-align: justify;">Note that We added <strong>SQL_NO_CACHE</strong> to prevent MySQL from caching query results.</p>
<p style="text-align: justify;">Now, it&#8217;s important to simulate many customers wandering around Zen Cart store. Therefore We used 10 threads to send queries to database.</p>
<p style="text-align: justify;">InnoDB managed to perform <strong>1186 </strong>queries per second on average, where MyISAM executed only <strong>958 </strong>queries per second on average. <strong>InnoDB was faster by almost 25%!</strong></p>
<h2 style="text-align: justify;"><strong>Locking strategy</strong></h2>
<p style="text-align: justify;">Very important feature (from performance perspective) is that InnoDB uses per row locking, where MyISAM uses table locking. What does it mean? We&#8217;ll clarify it with example.</p>
<p style="text-align: justify;">Let&#8217;s assume that We&#8217;re executing following update against products table:</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">UPDATE</span> products<br />
<span class="kw1">SET</span> products_ordered <span class="sy0">=</span> products_ordered <span class="sy0">+</span> 1<br />
<span class="kw1">WHERE</span> products_id <span class="sy0">=</span> <span class="nu0">12</span></div>
</div>
</div>
<p style="text-align: justify;">and other thread (other http request from other customer) is executing at the same time following query:</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">SELECT</span> products_type<br />
<span class="kw1">FROM</span> products<br />
<span class="kw1">WHERE</span> products_id <span class="sy0">=</span> <span class="st0">&#8217;17&#8242;</span></div>
</div>
</div>
<p style="text-align: justify;">Because MyISAM uses table locking when updates are made to tables, it will prevent execution of other SELECT queries until update statement finishes, even if those queries don&#8217;t look at updated rows.</p>
<p style="text-align: justify;">InnoDB on the other hand will lock only row with products_id field set to 17, allowing concurrent execution of SELECT queries (unless those queries are asking for data from updated row).</p>
<p style="text-align: justify;">It does not give much performance boost when Your store has low traffic, but when it&#8217;ll get more popular (hopefully<img src="http://www.data-diggers.com/sites/all/modules/fckeditor/fckeditor/editor/images/smiley/msn/wink_smile.gif" alt="" />) and You&#8217;ll have ten thousands visits per day it&#8217;ll make a difference ( the more traffic You&#8217;ll get the bigger the difference should be).</p>
<h2 style="text-align: justify;"><strong>How to convert MyISAM table to InnoDB table</strong></h2>
<p style="text-align: justify;">To convert any table example to InnoDB execute following SQL code:</p>
<div style="text-align: justify;">
<div class="codesnip-container" >
<div class="sql codesnip" style="font-family:monospace;"><span class="kw1">ALTER</span> <span class="kw1">TABLE</span> example ENGINE <span class="sy0">=</span> InnoDB</div>
</div>
</div>
<p style="text-align: justify;">Unfortunately Zen Cart database contains about 80 tables, so changing each of them by hand would be inconvenient. Also, one may want to change back to MyISAM for some reason, and it would have to repeat whole process again. To address that problem We created simple Zen Cart contribution that automates conversion from MyISAM to InnoDB. You can download it here:</p>
<p style="text-align: center;"><a href="http://www.data-diggers.com/contribs/change-storage-engine/downloads/change_storage_engine_current.zip">Download Change Storage Engine</a></p>
<p style="text-align: justify;">Installation is very easy, just copy unzipped folder to Your store directory. This contribution does not overwrite any Zen Cart files, so You don&#8217;t have to worry about that. To change <strong>all</strong> tables in Your database from MyISAM/InnoDB to InnoDB/MyISAM go to <em>Tools-&gt;Change Storage Engine</em> and click &#8216;Change&#8217;. That&#8217;s it!</p>
<h2 style="text-align: justify;"><strong>Summary</strong></h2>
<p style="text-align: justify;">InnoDB is faster then MyISAM engine, it also scales better. But before You change all Your tables to InnoDB make sure to (as always) make backup of Your database. Also, after changing tables to InnoDB check if Your store runs faster as MySQL performance differs from version to version.</p>
<h2 style="text-align: justify;"><strong>Updates</strong></h2>
<p style="text-align: justify;">Version 1.1 of Change Storage Engine is available (use link above, it always points to newest version). It&#8217;ll omit MyISAM tables with FULLTEXT indexes (InnoDB does not support FULLTEXT indexes).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.data-diggers.com/index.php/2009/01/innodb-vs-myisam-performance-in-zen-cart-which-is-better/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

