<?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>JortK.nl &#187; MySQL</title>
	<atom:link href="http://www.jortk.nl/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jortk.nl</link>
	<description>Mind farts of a crappy coder!</description>
	<lastBuildDate>Tue, 29 May 2012 13:38:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Scaling up your MySQL server</title>
		<link>http://www.jortk.nl/2010/03/scaling-up-your-mysql-server/</link>
		<comments>http://www.jortk.nl/2010/03/scaling-up-your-mysql-server/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 10:48:54 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1721</guid>
		<description><![CDATA[We use MySQL on most of our projects. One of these projects has a an access pattern unlike any other I&#8217;ve worked on. Several million records a day need to be written to a table. These records are then read out once at the end of the day, summarised and then very rarely touched again. [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>We use MySQL on most of our projects. One of these projects has a an access pattern unlike any other I&#8217;ve worked on. Several million records a day need to be written to a table. These records are then read out once at the end of the day, summarised and then very rarely touched again. Each record is about 104 bytes long (thre&#8217;s one VARCHAR column, everything else is fixed), and that&#8217;s after squeezing out every byte possible. The average number of records that we write in a day is 40 million, but this could go up.</p>
<p><span id="more-1721"></span></p>
<p><a title="Read the complete article" href="http://tech.bluesmoon.info/2009/09/scaling-writes-in-mysql.html" target="_blank">Read the complete article</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/03/scaling-up-your-mysql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>15 essential PHP and MySQL tutorials!</title>
		<link>http://www.jortk.nl/2010/03/15-essential-php-and-mysql-tutorials/</link>
		<comments>http://www.jortk.nl/2010/03/15-essential-php-and-mysql-tutorials/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:08:32 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[markers]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1480</guid>
		<description><![CDATA[Showing Google Maps with many markers in PHP Sometimes you need to display Google Maps with a large number of markers. However, adding too many markers makes the map page load too slow. This article explains how you can use marker cluster feature of the forms map location plug-in to cluster large numbers of markers [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a title="PHP tutorial on Google Maps" href="http://www.phpclasses.org/blog/package/1/post/7-Showing-Google-Maps-with-many-markers-in-PHP.html" target="_blank">Showing Google Maps with many markers in PHP</a><br />
Sometimes you need to display Google Maps with a large number of markers. However, adding too many markers makes the map page load too slow. This article explains how you can use marker cluster feature of the forms map location plug-in to cluster large numbers of markers to make the page load much faster.</p>
<p><a title="PHP Beginner tricks" href="http://webhostinghelpguy.inmotionhosting.com/udm" target="_blank">PHP Tricks For Beginners</a><br />
In the Web 2.0 era, sites are all about the user – where they’re from, what they like, what they ate for breakfast. This means the best sites now include content tailored to users, and one way to do that is through the use of PHP. These simple tricks won&#8217;t set the world on fire, but they&#8217;re a peek into the possibilities of PHP.</p>
<p><a title="Use WPF to create images" href="http://geekswithblogs.net/tkokke/archive/2009/06/01/image-generation-in-php-using-wpf.aspx" target="_blank">Image generation in PHP using WPF</a><br />
hp provides a number of graphical functions, but none is capable of creating rounded corners an gradients with ease. Everything has to be done by hand. WPF on the other hand uses xaml which supports everything you can think of in modern vector graphics design. Using a .NET assembly that takes a string of xaml and returns a PNG image would be the best in this case.</p>
<p><a title="PHP - cUrl" href="http://codestips.com/php-multithreading-using-curl/" target="_blank">PHP multithreading using cURL</a><br />
If you wanna get some information from servers using the protocols like http or ftp in PHP you can use cURL to do multithreading. Multithreading is a term used when we do more jobs in parallel. First I assume you know what cURL is and what you can it. If you are new to cURL, you can check one of my article on posting data with cURL , it will give you a brief intro to cURL.</p>
<p><a title="How to do TinyURL with PHP" href="http://davidwalsh.name/create-tiny-url-php" target="_blank">Create a TinyURL with PHP</a><br />
TinyURL is an awesome service. For those who don’t know what TinyURL is, TinyURL allows you to take a long URL like “http://davidwalsh.name/jquery-link-nudging” and turn it into “http://tinyurl.com/67c4se”. Using the PHP and TinyURL API, you can create these tiny URLs on the fly!</p>
<p><a title="Error suppresion in PHP" href="http://vega.rd.no/article/php-performance-error-suppression" target="_blank">PHP performance: error suppression</a><br />
A common misconception in the PHP community is that the @ operator is slow. It&#8217;s not. The real culprit is the generated error itself.</p>
<p><a title="Flex and PHP" href="http://ria.dzone.com/articles/php-and-flex-sockets" target="_blank">Communicating with Flex and PHP over Sockets </a><br />
There are a number of ways to communicate between Flex and PHP but one of the more interesting is over sockets. Socket communication lets developers create near real-time communication by pushing information directly to the client. In this article you&#8217;ll see the basics of how to use PHP as the socket server and connect it to a Flex application.</p>
<p><a title="How to calculate prime numbers with PHP" href="http://www.tellingmachine.com/post/Two-ways-to-test-for-prime-numbers-in-PHP-Sieve-and-File.aspx" target="_blank">Two ways to test for prime numbers in PHP: Sieve and File</a><br />
n PHP is really no ideal way to test large integers and determine whether they are prime numbers or not. The most popular algorithm for finding prime numbers is a memory and resource hog. It is called The Sieve of Eratosthenes. Besides the Sieve I also implemented a prime number test by initializing an array of prime numbers from a file that contains the first 100,000 prime numbers. This is of course much faster, but would require files that contain all prime numbers up to a specific large number. The files of course could be partitioned, which would also increase performance.</p>
<p><a title="Performance of the PHP compiler" href="http://www.phpclasses.org/blog/post/117-PHP-compiler-performance.html" target="_blank">PHP compiler performance</a><br />
With the release of Facebook HipHop PHP compiler, the matters of performance of PHP compilers and runtime engines gained special relevance. This article presents a performance comparison of between different PHP compilers and runtime PHP execution engines, so we can evaluate what is the best solution that can be used in different PHP environments.</p>
<p><a title="Source of this article" href="http://www.lightcubesolutions.com/blog/?p=209" target="_blank">MongoDB and PHP – A Quick Look at GridFS</a><br />
About 2 months ago we (LightCube Solutions) decided to install and mess around with MongoDB. We went from messing around to serious adoption about 2 weeks ago when we realized the power of working with it and PHP. It was Mitch Pirtle that first pointed us in this direction. Mitch was very enthusiastic about Mongo as he explained the great potential. Yet, it was only until I added an array of data from PHP into Mongo that my eyes started to open up.</p>
<p><a title="Optimize your SQL" href="http://pirringers.com/mysqlblog/?p=32" target="_blank">Converting and optimizing SQL Statements</a><br />
Now it became time to conveert some SQL statements. Even though many SELECT SQL statements will run unchanged in MYSQL it might be wise to check and see if they are performing well. There are some differences in how VFP and MYSQL optimize queries and a query that just performs great in VFP might be very slow in MYSQL. And then there are some cases where we have to replace things that are possible in VFP but not supported in MYSQL.</p>
<p><a title="Link to this MySQL tutorial" href="http://www.onlinehungama.com/2009/03/08/mysql-tutorial-create-table-in-database/" target="_blank">Mysql Tutorial – create table in database</a><br />
If you are a learner (new) in PHP / Mysql and don’t know how to create table in Mysql database from php file than Here is the easiest and error-free way to create table in Mysql database. see more with an example..</p>
<p><a title="Learn regexp" href="http://www.webdeveloperjuice.com/2010/03/08/8-basics-of-regular-expression-that-can-make-you-expert/" target="_blank">8 basics of regular expression that can make you expert</a><br />
Well, regular expressions have been something that I was scared of when I started coding as a serious stuff</p>
<p><a title="All About PHP Frameworks" href="http://www.phpbuilder.com/columns/Jason_Gilmore022510.php3" target="_blank">Five Fabulous PHP Frameworks<br />
</a>Today&#8217;s web developer must be well-equipped in order to fully harness the enormous horsepower and features at his disposal, not to mention satisfy the tastes of an increasingly finicky user. While taking advantage of a powerful development environment such as NetBeans or PDT certainly helps, it&#8217;s also imperative to embrace sound practices that ensure high quality, testable code written with a minimum investment of time and effort.</p>
<p><a title="Source of this article" href="http://www.phpdeveloper.org/news/14140" target="_blank">What&#8217;s the Right Way to Prevent SQL Injection in PHP Scripts? </a><br />
How to prevent SQL injection in PHP scripts is probably a topic that doesn&#8217;t need anything more written about it.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/03/15-essential-php-and-mysql-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Attention all MySQL Data warehouse users!</title>
		<link>http://www.jortk.nl/2010/02/attention-all-mysql-data-warehouse-users/</link>
		<comments>http://www.jortk.nl/2010/02/attention-all-mysql-data-warehouse-users/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 01:17:31 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[datawarehouse]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1459</guid>
		<description><![CDATA[One aspect of my positions with Calpont, MySQL, and other companies I’ve worked for has been to interact with the various analysts who cover the database scene. It’s definitely an interesting part of the job, especially when you get to query some of the experts who have been around a long time and are good [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>One aspect of my positions with Calpont, MySQL, and other companies I’ve worked for has been to interact with the various analysts who cover the database scene. It’s definitely an interesting part of the job, especially when you get to query some of the experts who have been around a long time and are good at making solid technology calls on where things are headed.</p>
<p>IDC is one such group of experts and they recently released an interesting set of predictions on where databases – and specifically data warehouses and analytic DB’s – are going. You can read the quick update they issued <a href="http://www.idc.com/getdoc.jsp?containerId=prUS22209010">HERE</a>.</p>
<p>A couple of their ‘within 5 year’ predictions I found particular interesting for MySQL data warehouse users are:</p>
<ul>
<li>Most data warehouses will be stored in a columnar fashion</li>
<li>Most large-scale database servers will achieve horizontal scalability through clustering</li>
</ul>
<p>This is helpful information for MySQL users who want to ensure they’re making the right bets on their data warehouse designs and the storage engines they’re choosing. It’s also good news because MySQL users now have a choice of column databases they can try out and see which is right for them.</p>
<p>I’ve written a new article on the MySQL dev zone on why you should check out a column database if you’re planning to implement a data warehouse, reporting database, or any read-intensive application. It talks about the why and why not’s of column DB’s, discusses why they matter, and provides some interesting benchmark tests of a leading row database vs. InfiniDB.</p>
<p>You can find the new article <a href="http://dev.mysql.com/tech-resources/articles/mysql-based-column-database.html">HERE</a>. Please let us know what you think and what plans you have for your data warehouses.</p>
<p>From: <a title="Source of this article" href="http://infinidb.org/infinidb-blog/interesting-and-good-news-for-mysql-data-warehouse-users.html" target="_blank">InfiniDB</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/02/attention-all-mysql-data-warehouse-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Missleading Innodb message on recovery</title>
		<link>http://www.jortk.nl/2010/02/missleading-innodb-message-on-recovery/</link>
		<comments>http://www.jortk.nl/2010/02/missleading-innodb-message-on-recovery/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 19:43:20 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/2010/02/missleading-innodb-message-on-recovery/</guid>
		<description><![CDATA[As I wrote about 2 years ago the feature of Innodb to store copy of master’s position in Slave’s Innodb tablespace got broken. There is a lot of discussions at the corresponding bug report while outcome of the fix remained uncertain for me (the bug is market duplicate while the bugs it seems to be [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>As I <a href="http://www.mysqlperformanceblog.com/2008/01/29/no-more-mysql-crash-safe-replication-in-50/">wrote </a>about 2 years ago the feature of Innodb to store copy of master’s position in Slave’s Innodb tablespace got broken. There is a lot of discussions at the corresponding <a href="http://bugs.mysql.com/bug.php?id=34058">bug report</a> while outcome of the fix remained uncertain for me (the bug is market duplicate while the bugs it seems to be duplicate for describe different issues).<br />
Anyway. The customer came to me today having the following message in the error log after Slave crash while running MySQL 5.1.41 (extra virgin version without XtraDB or Percona Patches)</p>
<blockquote><p>InnoDB: In a MySQL replication slave the last master binlog file<br />
InnoDB: position 0 10000000, file name mysql-bin.005000<br />
InnoDB: Last MySQL binlog file position 0 20000000, file name ./mysql-bin.003000</p></blockquote>
<p>He has tried to restart replication from mysql-bin.005000 position 10000000 which failed with “Could not find first log file name in binary log index file” error message</p>
<p>Looking at the Master for this slave I could see its binary log files going only to about 2000, so the binary log file mentioned did not ever exist on this master. What is going on ?<br />
The thing is Innodb does not update this information any more however if it is stored in the tablespace the code is still there to print it. This database was running older MySQL version a while back which was updated to MySQL 5.1 months ago, moved to the new hardware by physical copy and the log file numbers restarted back from 1 but tablespace still contained the ancient data.</p>
<p>I reported the <a href="http://bugs.mysql.com/bug.php?id=51202">bug</a> on this which should be easy to fix. Otherwise it is easy mistake to make. We also have a <a href="http://www.percona.com/docs/wiki/patches:transactional_replication">patch</a> which restores this information and uses it on slave crash recovery.</p>
<p>From: <a title="Source of this article" href="http://www.mysqlperformanceblog.com/2010/02/15/missleading-innodb-message-on-recovery/" target="_blank">MySQL Performance Blog</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/02/missleading-innodb-message-on-recovery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting up and shutting down a MySQL Server</title>
		<link>http://www.jortk.nl/2010/02/starting-up-and-shutting-down-a-mysql-server/</link>
		<comments>http://www.jortk.nl/2010/02/starting-up-and-shutting-down-a-mysql-server/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 19:11:22 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1247</guid>
		<description><![CDATA[No related posts. Related posts brought to you by Yet Another Related Posts Plugin.


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" title="MySQL functions" src="http://i47.tinypic.com/23leixh.jpg" alt="" width="720" height="540" /></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/02/starting-up-and-shutting-down-a-mysql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Storing Blobs in InnoDB</title>
		<link>http://www.jortk.nl/2010/02/storing-blobs-in-innodb/</link>
		<comments>http://www.jortk.nl/2010/02/storing-blobs-in-innodb/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 08:39:12 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[blob]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1267</guid>
		<description><![CDATA[I’m running in this misconception second time in a week or so, so it is time to blog about it. How blobs are stored in Innodb ? This depends on 3 factors. Blob size; Full row size and Innodb row format. But before we look into how BLOBs are really stored lets see what misconception [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I’m running in this misconception second time in a week or so, so it is time to blog about it.<br />
How blobs are stored in Innodb ? This depends on 3 factors. Blob size; Full row size and Innodb row format.</p>
<p>But before we look into how BLOBs are really stored lets see what misconception is about. A lot of people seems to think for standard (”Antelope”) format first 768 bytes are stored in the row itself while rest is stored in external pages, which would make such blobs really bad. I even seen a solution to store several smaller blobs or varchar fields which are when concatenated to get the real data. This is not exactly what happens</p>
<p>With <strong>COMPACT</strong> and <strong>REDUNDANT</strong> row formats (used in before Innodb plugin and named “Antelope” in Innodb Plugin and XtraDB) Innodb would try to fit the whole row onto Innodb page. At least 2 rows have to fit to each page plus some page data, which makes the limit about 8000 bytes. If row fits completely Innodb will store it on the page and not use external blob storage pages. For example 7KB blob can be stored on the page. However if row does not fit on the page, for example containing two 7KB blobs Innodb will have to pick some of them and store them in external blob pages. It however will keep at least 768 bytes from each of the BLOBs on the row page itself. With two of 7KB blobs we will have one blob stored on the page completely while another will have 768 bytes stored on the row page and the remainder at external page.</p>
<p>Such decision to store first 768 bytes of the BLOB may look strange, especially as MySQL internally has no optimizations to read portions of the blob – it is either read completely or not at all, so the 768 bytes on the row page is a little use – if BLOB is accessed external page will always have to be read. This decision seems to be rooted in desire to keep code simple while implementing initial BLOB support for Innodb – BLOB can have prefix index and it was easier to implement index BLOBs if their prefix is always stored on the row page.</p>
<p>This decision also causes strange data storage “bugs” – you can store 200K BLOB easily, however you can’t store 20 of 10K blobs. Why ? Because each of them will try to store 768 bytes on the row page itself and it will not fit.</p>
<p>Another thing to beware with Innodb BLOB storage is the fact external blob pages are not shared among the blobs. Each blob, even if it has 1 byte which does not fit on the page will have its own 16K allocated. This can be pretty inefficient so I’d recommend avoiding multiple large blobs per row when possible. Much better decision in many cases could be combine data in the single large Blob (and potentially compress it)</p>
<p>If all columns do not fit to the page completely Innodb will automatically chose some of them to be on the page and some stored externally. This is not clearly documented neither can be hinted or seen. Furthermore depending on column sizes it may vary for different rows. I wish Innodb would have some way to tune it allowing me to force actively read columns for inline store while push some others to external storage. May be one day we’ll come to implementing this in XtraDB</p>
<p>So BLOB storage was not very efficient in REDUNDANT (MySQL 4.1 and below) and COMPACT (MySQL 5.0 and above) format and the fix comes with Innodb Plugin in “Barracuda” format and <strong>ROW_FORMAT=DYNAMIC. </strong>In this format Innodb stores either whole blob on the row page or only 20 bytes BLOB pointer giving preference to smaller columns to be stored on the page, which is reasonable as you can store more of them. BLOBs can have prefix index but this no more requires column prefix to be stored on the page – you can build prefix indexes on blobs which are often stored outside the page.</p>
<p><strong>COMPRESSED row format </strong>is similar to DYNAMIC when it comes to handling blobs and will use the same strategy storing BLOBs completely off page. It however will always compress blobs which do not fit to the row page, even if KEY_BLOCK_SIZE is not specified and compression for normal data and index pages is not enabled.</p>
<p>If you’re interested to learn more about Innodb row format check out <a href="http://www.innodb.com/doc/innodb_plugin-1.0/innodb-row-format.html">this page</a> in Innodb docs:</p>
<p>It is worth to note I use BLOB here in a very general term. From storage prospective BLOB, TEXT as well as long VARCHAR are handled same way by Innodb. This is why Innodb manual calls it “long columns” rather than BLOBs.</p>
<p>From: <a title="Source of this article - MySQL performance blog" href="http://www.mysqlperformanceblog.com/2010/02/09/blob-storage-in-innodb/" target="_blank">MySQL Performance Blog</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/02/storing-blobs-in-innodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Caching Techniques</title>
		<link>http://www.jortk.nl/2010/02/mysql-caching-techniques/</link>
		<comments>http://www.jortk.nl/2010/02/mysql-caching-techniques/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 15:01:03 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1269</guid>
		<description><![CDATA[Recently Jay Pipes published great article about lazy connecting and caching which reminded me my post on this matter is well overdue. Let me start with couple of comments about Jays article. First – caching in files should be used with caution. It may be very efficient especially if number of cached objects is small [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Recently Jay Pipes published great article about <a href="http://jpipes.com/index.php?/archives/99-MySQL-Connection-Management-in-PHP-How-Not-To-Do-Things.html">lazy connecting and caching</a> which reminded me my post on this matter is well overdue.</p>
<p>Let me start with couple of comments about Jays article. First – caching in files should be used with caution. It may be very efficient especially if number of cached objects is small but if you get too many small objects which need to be cached files can become inefficient, especially if you do not care about putting them into different directories on file systems which can’t handle too many files in the same directory efficiently. The other problem with files is of course being local to the local node which might be inefficient with many web servers. Putting cache on shared storage could work but that is extra complication. There are cases when file cache works pretty well – for example caching full page results in files can be extremely efficient, especially if you can ofload sending cache result to the client by web server (instead of doing it from PHP). The other case when caching in files can be very helpful is caching data long term – ie if you got it from some Web Service. For smaller short lived objects things like memcached (or local shared memory for small installations) can be more efficient.</p>
<p>Lets now get to the main point of this article – I wanted to talk in a bit more details about caching algorithms and for which kind of application each of them can work.</p>
<p><strong>TTL Based Caching</strong> This is probably most common approach for cache organization in the Web – you cache the object and say it is going to expire in 60 seconds. This type of caching is even supported by HTTP protocol with its <em>Expires</em> Header. This approach to the caching is very simple and pretty efficient, however it leads to having stale data which is problematic for some applications, also objects may expire before they are really modified so cache can be less efficient than possible. TTL caching is great if you have no way to know when object has changed. For example if you retrieve product information from Amazon Web Services, you have no way to get notification about it being changed so the only thing you can do is check if it was changed every so often.</p>
<p><strong>Cache Invalidate</strong> With this apporach you invalidate or remove objects in cache once underlying information is updated. This is how MySQL Query Cache works by removing all queries derived from the table if that table is updated. This technique requires you to know which objects are based on which data so you can invalidate wisely and of course have update notifications. This cache can be more efficient with rare updates but you better to have fine grain control of what has to be invalidated – approach used by MySQL Query Cache is too coarse invalidating a lot of queries which really do not need to be. The other problem with this method is – invalidation can be expensive, especially if you get many objects cached and they are stored on the storage or network rather than local memory. This approach works very well if you cache is structured so each update removes only one object from the cache.</p>
<p><strong>Cache Update</strong> This one is quite similar to cache-invalidate approach but with difference what cache content is actually renewed rather than invalidated. This approach is more efficient, especially if renewing is done in background as it greatly reduces number of cache misses, while it also wastes resources by updating what might never be needed again. Another complication for this approach is – cache has to become active and know how to update cache content rather than being simply storage system. You can also mix cache update and cache-invalidate approaches efficiently. For example I worked with one company having trouble with some Full Text Search requests – they just were way to slow, while some of them was very frequent. Until Full Text itself could be optimized we added cache update algorithm which would populate cache with result set for most frequent and complicated queries as new data is loaded and index is rebuilt.</p>
<p><strong>Version based caching </strong>This could be thought about as modification of previous ones but I will put it as separate item as it is quite efficient way to organize things. In this case version is associated with each of the data sources used to compose the object. For each of the object data source versions are stored together with cached data. Once you take object out of cache you validate if all versions are still current and use it or throw it away. The good thing about this approach is – you cache operations have constant complexity – you do not have to do big invalidation clean up on updates. Let me come with example how it can work in practice. Lets say you’re running big blogging site which has many blogs published. You may store blog version which is updated on each blog modification and have all cache lookups for this user to check if blog version has chaged. You can become more fine grained and have versions added to blog entries so if comment is added to post B you do not invalidate post A. Of course this method also has its downsides – you have to perform extra version check on each lookup and it might be complicated and caching bugs hard to debug, but it can give very good cache efficiency for some applications.</p>
<p>These are of course only some of the approaches which you can use, and in many cases mixing them may make sense. You may use TTL for some of the objects while invalidation for others.</p>
<p>Thanks to: <a title="Source of this article" href="http://www.mysqlperformanceblog.com/2006/08/08/caching-techinques/" target="_blank">MySQL Performance Blog</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/02/mysql-caching-techniques/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>11 MySQL resources you must read!</title>
		<link>http://www.jortk.nl/2010/02/11-mysql-resources-you-must-read/</link>
		<comments>http://www.jortk.nl/2010/02/11-mysql-resources-you-must-read/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 17:46:04 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[cast]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1243</guid>
		<description><![CDATA[Conditional joins in MySQL One way to do a “Conditional Join” in MySQL is by using a “LEFT JOIN”.  Create a “LEFT JOIN” for each condition and combine the results into one column using an “IF” statement by the “SELECT” expression Monitoring your MySQL errors Great tutorial on how to monitor your MySQL Server for [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a title="Conditional joins in MySQL" href="http://www.mysqldiary.com/conditional-joins-in-mysql/" target="_blank">Conditional joins in MySQL</a><br />
One way to do a “Conditional Join” in MySQL is by using a “LEFT JOIN”.  Create a “LEFT JOIN” for each condition and combine the results into one column using an “IF” statement by the “SELECT” expression</p>
<p><a title="Error monitoring in MySQL" href="http://www.facebook.com/note.php?note_id=293204560932" target="_blank">Monitoring your MySQL errors</a><br />
Great tutorial on how to monitor your MySQL Server for errors.</p>
<p><a title="New benchmark" href="http://www.mysqlperformanceblog.com/2010/01/28/new-olap-wikistat-benchmark-introduction-and-call-for-feedbacks/" target="_blank">New OLAP Wikistat benchmark: Introduction and call for feedbacks</a><br />
Article about a new benchmark.</p>
<p><a title="How to use MySQL in a cluster" href="http://blogs.sun.com/LinuxJedi/entry/mysql_cluster_uses" target="_blank">How to use MySQL cluster</a><br />
MySQL Cluster can be used as a general purpose transactional storage engine, but if you convert all your InnoDB tables to it and connect your application straight to it you may not see the performance you were hoping for.  This is because MySQL Cluster was originally designed for real-time telecommunications applications (such as RADIUS servers).  It has slowly been modified to become more general purpose and improvements are being made every day but there are still some performance considerations which go with this.  In some cases tweaking your schema and/or queries can help performance dramatically, so I shall try and outline some of things to watch for here.</p>
<p><a title="Source of this article" href="http://mysqldba.blogspot.com/2010/02/innodbfilepertable-shrinking-table.html" target="_blank">innodb_file_per_table, shrinking table spaces and the data dictionary </a><br />
INNODB has some irritating gotchas that makes disk space management hard. In 2002ish INNODB, added innodb_file_per_table to get around allot of these issues, but it does not fix everything.</p>
<p><a title="Case study on MySQL performance improvement" href="http://ronaldbradford.com/blog/10x-performance-improvements-in-mysql-a-case-study-2010-02-07/" target="_blank">10x Performance Improvements in MySQL – A Case Study</a><br />
Slideshow with tips on how to improve the performance of your MySQL server</p>
<p><a title="Source of this tutorial" href="http://venublog.com/2010/02/03/show-temporary-tables/" target="_blank">SHOW TEMPORARY TABLES</a><br />
I had this patch for a while where one can get listing of both session and global temporary tables across all sessions. It really helped lot of times to understand the bottlenecks of some of the temporary table issues as MySQL never exposed them in the form of SHOW TABLES.</p>
<p><a title="How to make good use of MySQL table functions" href="http://krow.livejournal.com/680925.html" target="_blank">Fun with Table Functions</a><br />
Great tricks on how to use table functions.</p>
<p><a title="Query tutorial" href="http://explainextended.com/2010/02/01/join-on-overlapping-date-ranges/" target="_blank">Join on overlapping date ranges</a><br />
Query example how to join data with overlapping date ranges.</p>
<p><a title="Why use implicit casting?" href="http://code.openark.org/blog/mysql/beware-of-implicit-casting" target="_blank">Beware of implicit casting</a><br />
Ever so often a query provides a “bad” execution plan. Adding a missing index can many times solve the problem. However, not everything can be solved with an index. I wish to highlight the point of having an implicit cast, which negates the use of an index on MySQL.</p>
<p><a title="The way that MySQL is using CHECK TABLE with InnoDB tables" href="http://shinguz.blogspot.com/2010/01/what-is-check-table-doing-with-innodb.html" target="_blank">What is CHECK TABLE doing with InnoDB tables?</a><br />
Find out in this article what CHECK TABLE is doing with InnoDB table.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/02/11-mysql-resources-you-must-read/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A MySQL mojo leaves Oracle</title>
		<link>http://www.jortk.nl/2010/02/a-mysql-mojo-leaves-oracle/</link>
		<comments>http://www.jortk.nl/2010/02/a-mysql-mojo-leaves-oracle/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 09:35:29 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1240</guid>
		<description><![CDATA[Ever since Oracle closed on its acquisition of MySQL, the open-source world has been wondering where the code has gone. Many people searched, fruitlessly, for the formerly available MySQL source code. They might have done better to search for Oracle&#8217;s point person on MySQL, Ken Jacobs. On Friday, Jacobs announced his resignation from Oracle to [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Ever since Oracle closed on its acquisition of MySQL, the open-source world has been <a href="http://twitter.com/doomed9/statuses/8683800398">wondering</a> where the code has gone. Many people searched, fruitlessly, for the formerly available MySQL source code.</p>
<p>They might have done better to search for Oracle&#8217;s point person on MySQL, Ken Jacobs.</p>
<p>On Friday, Jacobs announced his resignation from Oracle to key members of the MySQL team via e-mail. Jacobs, a 28-year Oracle veteran and one of its first 20 hires, has been Oracle&#8217;s liaison with the MySQL community for the past several years, ever since <a href="http://jeremy.zawodny.com/blog/archives/005490.html">Oracle acquired</a> the popular MySQL storage engine, InnoDB.</p>
<p>While Jacobs doesn&#8217;t give an explicit reason for his departure, he does hint at disappointment that he was not selected to run MySQL&#8217;s database business post-acquisition. &#8220;I imagine you all know that I will not be leading the MySQL GBU, as I had expected,&#8221; he said.</p>
<p>I share that disappointment.</p>
<p>I, among others, worried that Oracle&#8217;s acquisition of InnoDB effectively <a href="http://asay.blogspot.com/2005/11/of-patent-pools-and-open-source.html">amounted to a hostile takeover of MySQL&#8217;s financial fortunes</a>, but such has not been the case. Arguably, Jacobs is a primary reason that Oracle&#8217;s ownership of InnoDB has been peaceful, not a declaration of war.</p>
<p>I don&#8217;t expect Jacobs&#8217; departure to significantly alter Oracle&#8217;s plans for MySQL, which I believe to be good (the temporary absence of source code notwithstanding), but I do worry that his thoughtful interaction with the open-source community will be missed.</p>
<p>Jacobs, himself, in his departure e-mail, noted the benefits MySQL will receive from Oracle&#8217;s ownership:</p>
<blockquote><p>I know that there are many people in the open source community who are concerned about Oracle&#8217;s plans for MySQL. They are wrong to worry. Oracle will keep its commitments to invest in MySQL, and help grow the business. Oracle will make MySQL better. Doing so gives Oracle a presence in new markets, and the resources and investment Oracle will make should mean great things for customers, as well as the larger community.</p>
<p>You will find Oracle a terrific place to work! I believe it is good for MySQL (the product, the company, the people and the community) that you are now part of a software company. And a database company. And a company that is profitable, and that innovates and delivers high customer satisfaction. That&#8217;s where MySQL belongs!</p></blockquote>
<p><a href="http://www.oracle.com/us/corporate/press/016340">Edward Screven</a>, Oracle&#8217;s chief corporate architect, will be overseeing all-things-open-source at Oracle, leaving less room for Jacobs but also demonstrating Oracle&#8217;s positive intentions for MySQL. Screven reports directly to Oracle CEO Larry Ellison and should be a good advocate for MySQL within the company.</p>
<p>Even so, I will miss Jacobs. I have had many interactions with him over the years, and he has always proved to be a thoughtful, measured advocate for and defender of Oracle. His influence will be missed at Oracle as it takes on the arduous task of managing the world&#8217;s largest database community.</p>
<p>From: <a title="Source of this article" href="http://news.cnet.com/8301-13505_3-10448783-16.html" target="_blank">CNet</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/02/a-mysql-mojo-leaves-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful PHP and MySQL articles to improve your development skills!</title>
		<link>http://www.jortk.nl/2010/01/useful-php-and-mysql-articles-to-improve-your-development-skills/</link>
		<comments>http://www.jortk.nl/2010/01/useful-php-and-mysql-articles-to-improve-your-development-skills/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 16:30:05 +0000</pubDate>
		<dc:creator>JortK</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[factory method]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[pivot]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://www.jortk.nl/?p=1145</guid>
		<description><![CDATA[CakePHP Authsome Authentication for people who hate the AuthComponent. Triggering Cascading Updates and Deletions with Foreign Key Constraints Cool article how to create cascading updates and deletions on your MySQL database using key constraints. Create Pivot Tables in PHP Tutorial on how you can use PHP to create Pivot Tables. Working in the Method Scope [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a title="Coll plugin for CakePHP" href="http://www.debuggable.com/posts/cakephp-authsome-debuggable-s-xmas-gift:4b34b4e6-9ca4-4673-bea6-4776cbdd56cb" target="_blank">CakePHP Authsome</a><br />
Authentication for people who hate the AuthComponent.<span id="more-1145"></span></p>
<p><a title="MySQL tutorial on cascading deletes and updates" href="http://www.devshed.com/c/a/PHP/Triggering-Cascading-Updates-and-Deletions-with-Foreign-Key-Constraints/" target="_blank">Triggering Cascading Updates and Deletions with Foreign Key Constraints </a><br />
Cool article how to create cascading updates and deletions on your MySQL database using key constraints.</p>
<p><a title="How to create pivot tables using PHP" href="http://gonzalo123.wordpress.com/2010/01/24/pivot-tables-in-php/" target="_blank">Create Pivot Tables in PHP</a><br />
Tutorial on how you can use PHP to create Pivot Tables.</p>
<p><a title="How to use Method Scope in PHP" href="http://www.devshed.com/c/a/PHP/Working-in-the-Method-Scope-with-Static-Variables-in-PHP-5-Classes/" target="_blank">Working in the Method Scope with Static Variables in PHP 5 Classes </a><br />
Despite their name, static properties can help in a wide variety of situations. If you&#8217;re not using them currently, and you regularly implement design patterns in your code, after reading this series you&#8217;ll wonder how you ever did without them.</p>
<p><a title="Article on all bad pratices on PHP" href="http://www.sellmix.com/blog/php/php-mistakes-bad-practices-no-nos/" target="_blank">PHP mistakes, misconceptions, bad practices and blatant no nos.</a><br />
Go to any PHP help forum and you’ll be sure to see many bad practises, innocent misconceptions and blatant no nos. None of us are perfect and none of us started off writing great code. We have all had that moment where we looked back on a script that we wrote years ago and thought “what the hell was I thinking?”. But it is a process. You make mistakes, you learn from those mistakes and then you move on.</p>
<p><a title="Artcile on the Composite PHP pattern" href="http://giorgiosironi.blogspot.com/2010/01/practical-php-patterns-composite.html" target="_blank">Practical Php Patterns: Composite</a><br />
One of the most important structural patterns is the Composite one: its goal is managing a hierarchy of objects where both leaf objects and composition of other objects conform to a common interface. This hierarchy is usually constituted by part-whole relationships (often composition in the strict sense or aggregation), and it can be viewed as a tree.</p>
<p><a title="Tutorial on relations" href="http://giorgiosironi.blogspot.com/2010/01/relationships-between-objects.html" target="_blank">Relationships between objects</a><br />
Clear article where relationships between objects are explained.</p>
<p><a title="Tutorial on how to implement factory methods in PHP 5" href="http://www.devshed.com/c/a/PHP/Implementing-Factory-Methods-in-PHP-5/" target="_blank">Implementing Factory Methods in PHP 5</a><br />
If you’ve ever developed desktop applications using mature object-oriented languages like C++ and Java, then it’s possible that you’ve found yourself saying a few funny phrases such as “I need to implement a factory method within this class,” or in the worst case: “this class needs to implement a factory method, but I don’t have a single clue about how to do that.” Surprisingly, you can implement these factory methods pretty quickly and easily in PHP 5.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jortk.nl/2010/01/useful-php-and-mysql-articles-to-improve-your-development-skills/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
