<?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>SoftLayer Blog &#187; DBA</title>
	<atom:link href="http://blog.softlayer.com/tag/dba/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.softlayer.com</link>
	<description>A Behind the Scenes Look at the Best Hosting Provider in the World</description>
	<lastBuildDate>Wed, 15 May 2013 15:33:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>MySQL Slow? Check for Fragmentation.</title>
		<link>http://blog.softlayer.com/2011/mysql-slow-check-for-fragmentation/</link>
		<comments>http://blog.softlayer.com/2011/mysql-slow-check-for-fragmentation/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 13:30:21 +0000</pubDate>
		<dc:creator>Lee Thompson</dc:creator>
				<category><![CDATA[Customer Service]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[administrator]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[fragmentation]]></category>
		<category><![CDATA[fragmented]]></category>
		<category><![CDATA[managed hosting]]></category>
		<category><![CDATA[managed services]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/2011/</guid>
		<description><![CDATA[Let&#8217;s say you have a website and you notice that any calls to your MySQL database take longer to render. If you don&#8217;t have a Database Administrator (DBA), this can be pretty frustrating. SoftLayer&#8217;s Managed Hosting line of business employs some of the best DBAs in the country and is one of the only managed [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you have a website and you notice that any calls to your MySQL database take longer to render. If you don&#8217;t have a Database Administrator (DBA), this can be pretty frustrating. SoftLayer&#8217;s <a href="http://www.softlayer.com/managed-ps">Managed Hosting</a> line of business employs some of the best DBAs in the country and is one of the only managed hosting providers that offers MySQL and MsSQL DBA services, and I don&#8217;t just say that because I&#8217;m one of them &#8230; We&#8217;ve got the certifications to prove it. <img src='http://blog.softlayer.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Given my area of expertise, I wanted to share a few some simple tips with you to help you tweak variables and improve the performance of your MySQL server. Given that every application is different, this isn&#8217;t necessarily a one-size-fits-all solution, but it&#8217;ll at least give you a starting point for troubleshooting.</p>
<p><strong>First: Get mysqltuner.pl.</strong> This is a fine script by Major Hayden that will give you some valuable information regarding the performance of your MySQL server. </p>
<p><strong>Second: Look for fragmented tables.</strong> What are fragmented tables? If there are random insertions into or deletions from the indexes of a table, the indexes may become fragmented. Fragmentation means that the physical ordering of the index pages on the disk is not close to the index ordering of the records on the pages or that there are many unused pages in the 64-page blocks that were allocated to the index. The symptoms of fragmented tables can be that table can take more disk space than needed or the results may return slower with more disk I/O than needed. <a href="http://www.innodb.com/">INNODB</a> users need to check the fragmentation often because when INNODB marks data as deleted, it never overwrites the blocks with new data &#8230; It just marks them as unusable. As a result, the data size is artificially inflated and data retrieval is slowed. </p>
<p>Fortunately, there is a way to see your table fragmentation and that is to run a query against the <code>information_schemea</code> to show all tables that are fragmented and the percentage of fragmentation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">SELECT TABLE_SCHEMA, TABLE_NAME, CONCAT<span style="color: #7a0874; font-weight: bold;">&#40;</span>ROUND<span style="color: #7a0874; font-weight: bold;">&#40;</span>data_length <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">1024</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1024</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #ff0000;">'MB'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> DATA, CONCAT<span style="color: #7a0874; font-weight: bold;">&#40;</span>ROUND<span style="color: #7a0874; font-weight: bold;">&#40;</span>data_free  <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">1024</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1024</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #ff0000;">'MB'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>FREE from information_schema.TABLES where TABLE_SCHEMA NOT IN <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'information_schema'</span>,<span style="color: #ff0000;">'mysql'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> and Data_free <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000;">0</span>;</pre></div></div>

<p>Fixing the fragmentation is easy, but there are a few caveats. When defragmenting a table, it will lock the table, so make sure you can afford the lock. To fix fragmented tables, you can simply run <code>optimize table &lt;table name&gt;;</code> to rebuild the table and all indexes or you can change the engine of the table with <code>alter table &lt;table name&gt; engine = INNODB;</code></p>
<p>I have written a simple bash script in bash to go through, defragment and optimize your tables:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">MYSQL_LOGIN</span>=<span style="color: #ff0000;">'-u&lt;user name&gt; --password=&lt;passowrd&gt;'</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> db <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;SHOW DATABASES;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mysql <span style="color: #007800;">$MYSQL_LOGIN</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;Database&quot;</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;information_schema&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">TABLES</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;USE <span style="color: #007800;">$db</span>; SHOW TABLES;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mysql <span style="color: #007800;">$MYSQL_LOGIN</span> <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> Tables_in_<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Switching to database <span style="color: #007800;">$db</span>&quot;</span>
        <span style="color: #000000; font-weight: bold;">for</span> table <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TABLES</span>
        <span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot; * Optimizing table <span style="color: #007800;">$table</span> ... &quot;</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;USE <span style="color: #007800;">$db</span>; OPTIMIZE TABLE <span style="color: #007800;">$table</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mysql <span style="color: #007800;">$MYSQL_LOGIN</span> <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done.&quot;</span>
        <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>You&#8217;d be surprised how much of an impact table fragmentation has on MySQL performance, and this is an easy way to quickly troubleshoot your database that &#8220;isn&#8217;t as fast as it used to be.&#8221; If you follow the above steps and still can&#8217;t make sense of what&#8217;s causing your database to lag, our Managed Hosting team is always here to work with you to get your servers back in shape &#8230; And with the flexibility of month-to-month contract terms and the ability to add managed capabilities to specific pieces of your infrastructure, we have to earn your business every month with spectacular service.</p>
<p>-Lee</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2011/mysql-slow-check-for-fragmentation/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>3 Bars &#124; 3 Questions: SoftLayer Managed Hosting</title>
		<link>http://blog.softlayer.com/2011/3-bars-3-questions-softlayer-managed-hosting/</link>
		<comments>http://blog.softlayer.com/2011/3-bars-3-questions-softlayer-managed-hosting/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 13:30:44 +0000</pubDate>
		<dc:creator>Tam Vu</dc:creator>
				<category><![CDATA[3 Bars 3 Questions]]></category>
		<category><![CDATA[Culture]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[3 Bars]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[managed hosting]]></category>
		<category><![CDATA[managed server]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[sales engineering]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/2011/</guid>
		<description><![CDATA[I know you expected to see a video interview with Paul Ford the next time a 3 Bars &#124; 3 Questions episode rolled across your desk, but I snuck past him for a chance in the spotlight this week. Kevin and I jumped on a quick video chat to talk about the Sales Engineering team, [...]]]></description>
			<content:encoded><![CDATA[<p>I know you expected to see a video interview with Paul Ford the next time a <a href="http://blog.softlayer.com/category/3-bars-3-questions/">3 Bars | 3 Questions</a> episode rolled across your desk, but I snuck past him for a chance in the spotlight this week. Kevin and I jumped on a quick video chat to talk about the Sales Engineering team, and because of our recent <a href="http://www.softlayer.com/press/release/881/softlayer-launches-managed-hosting">release</a> of SoftLayer Managed Hosting, two of the three questions ended up being about that news:</p>
<div class="yt560"><iframe width="560" height="349" src="http://www.youtube.com/embed/54gnFBTKBrM" frameborder="0" allowfullscreen></iframe></div>
<p>You should be seeing a blog from <a href="http://blog.softlayer.com/author/nday/">Nathan</a> in the next half hour or so with more detail about how we approached managed hosting, so you&#8217;ll have all the background you need to springboard into that post after you watch this video.</p>
<p>If you&#8217;ve heard everything you need to hear about managed hosting and want to start the process of adding it to servers on your account, visit <a href="http://www.softlayer.com/solutions/managed-hosting/">http://www.softlayer.com/solutions/managed-hosting/</a> or chat with a sales rep, and they can help you get squared away. If you&#8217;re not sure whether it&#8217;s a good fit, ask for a sales engineer to consult &#8230; They&#8217;re a great group with a pretty awesome manager. <img src='http://blog.softlayer.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Paul, sorry for stealing your spot in the 3 Bars | 3 Questions rotation! I&#8217;m handing the baton back over to you to talk about TechWildcatters and the Technology Partners Marketplace in the next episode.</p>
<p>-Tam</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2011/3-bars-3-questions-softlayer-managed-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
