<?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>Wire Turf &#187; MySql</title>
	<atom:link href="http://www.wireturf.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wireturf.com</link>
	<description></description>
	<lastBuildDate>Sat, 13 Mar 2010 06:06:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Surprise! Not all Amazon EC2 compute units are created equal</title>
		<link>http://www.wireturf.com/2010/01/10/surprise-not-all-amazon-ec2-compute-units-are-created-equal/</link>
		<comments>http://www.wireturf.com/2010/01/10/surprise-not-all-amazon-ec2-compute-units-are-created-equal/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 19:11:35 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://www.wireturf.com/?p=116</guid>
		<description><![CDATA[A very interesting discovery made by our sys admin not so long ago: While Amazon EC2 sells its hosting services on the notion of leasing virtualized servers with a guaranteed amount of standard compute units, memory and disk space, it turns out that in fact, not all EC2 compute units are created equal. In other [...]]]></description>
			<content:encoded><![CDATA[<p>A very interesting discovery made by our sys admin not so long ago: While <a href="http://aws.amazon.com/ec2/" rel="nofollow" target="_blank">Amazon EC2</a> sells its hosting services on the notion of leasing virtualized servers with a guaranteed amount of standard compute units, memory and disk space, it turns out that in fact, not all EC2 compute units are created equal. In other words, imagine you boot up 2 separate virtual servers (or instances as they are known in EC2 speak) and these are both <a href="http://aws.amazon.com/ec2/#instance" rel="nofollow" target="_blank">EC2 Extra Large instances</a>. Each instance comes with 8 EC2 compute units &#8211; which is essentially supposed to be the amount of raw CPU processing power available to you where the larger the number of compute units, the more processing power your (server) instance should be giving you.</p>
<p>Now one would expect that since you are paying the same amount of money to Amazon for each server instance created of this same type and size, that you should be getting the same performance out of each one. Sadly, that is a very wrong assumption, as our sys admin found out.</p>
<p>It turns out that the underlying hardware for each instance created impacts the actual performance that each instance gives you, even though the instances are all virtualized and marketed by Amazon as if they are all created equal. In our case, we found that the different underlying hardware that the virtual instance sits on has a significant impact on application performance, at least with respect to MySQL database performance. Instances that were created on machines with AMD&#8217;s Opteron 270 processors (2ghz 1mb L2 cache) showed significantly poorer MySQL performance compared to instances created on machines with Intel&#8217;s Xeon e5430 processors (2.66ghz 6mb L2 cache). Well, the hardware techies among you out there might be saying &#8220;well duh&#8230; of course the Xeon will spank with the Opteron, tell me something I don&#8217;t already know.&#8221; But that&#8217;s not the point.</p>
<p>The point is in both cases, the EC2 customer is paying the same for an instance that is marketed as having identical compute units (i.e. processing power), but the reality is very different. Bear in mind that one cannot select what underlying hardware you want your instances to be powered up on &#8211; what we did was simply keep destroying and creating new instances until we found that the new instance was created on the Xeon-based hardware that we wanted (TIP: from the Linux shell of the new instance, run this to see what hardware your instance was created on: cat /proc/cpuinfo).</p>
<p>Moral: while cloud computing with Amazon (or likely any other vendor of this ilk) has definite pluses, there are hidden gotchas that they don&#8217;t tell you about.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wireturf.com/2010/01/10/surprise-not-all-amazon-ec2-compute-units-are-created-equal/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Handy SQL snippet: Easily calculate average age of all members from DOB</title>
		<link>http://www.wireturf.com/2009/07/31/handy-sql-snippet-easily-calculate-average-age-of-all-members-from-dob/</link>
		<comments>http://www.wireturf.com/2009/07/31/handy-sql-snippet-easily-calculate-average-age-of-all-members-from-dob/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 00:06:29 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://www.wireturf.com/?p=105</guid>
		<description><![CDATA[The problem: Let&#8217;s say you have a database with a members or users list and you have the birthdate of these members stored in a date or datetime format (i.e. 1985-07-31 or similar). Now let&#8217;s say you would like to know the average age of the members in your list. This incidentally was exactly the [...]]]></description>
			<content:encoded><![CDATA[<p>The problem: Let&#8217;s say you have a database with a members or users list and you have the birthdate of these members stored in a date or datetime format (i.e. 1985-07-31 or similar). Now let&#8217;s say you would like to know the average age of the members in your list. This incidentally was exactly the problem I faced this afternoon. So what&#8217;s an easy way to do it in a matter of seconds? Simple once you have it figured it out.</p>
<p>If you have the list stored in a MySQL database, this little snippet will get the job done easily:</p>
<p>SELECT avg( (year( now() ) &#8211; year( [birthdate] ) ) + (DAYOFYEAR( now() ) > DAYOFYEAR( [birthdate] ) ) ) FROM [tablename]</p>
<p>Note: you need to replace [tablename] with the actual tablename (without the square brackets of course) and [birthdate] with the actual name of the column in your [tablename] in which you store the birthdate.</p>
<p>So what&#8217;s going on here?</p>
<p>Here&#8217;s the breakdown of what it&#8217;s doing:</p>
<ul>
<ol>
Step 1 &#8211; We calculate each member&#8217;s age by subtracting the year we are now in from the year of their birth: year( now() ) &#8211; year( [birthdate] )
</ol>
<ol> Step 2 &#8211; We check if as of right now, that person&#8217;s birthday has already passed, and if so, we will be adding 1 year to their age, if not, we don&#8217;t add a year: + ( DAYOFYEAR( now() ) > DAYOFYEAR([birthdate]) )
</ol>
<ol>
Step 3 &#8211; We are selecting the birthdays from the relevant table in the db, and with each record, doing the calculation and taking an average, i.e. the avg () portion
</ol>
</ul>
<p>And that&#8217;s it!</p>
<p>I don&#8217;t remember offhand the syntax if you were doing this in another db, such as MS SQLServer or Postgres, but the syntax should be very similar (or exactly the same, just depending on whether those functions operate exactly the same in those dbs).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wireturf.com/2009/07/31/handy-sql-snippet-easily-calculate-average-age-of-all-members-from-dob/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
