<?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>Anna Filina &#187; mysql</title>
	<atom:link href="http://annafilina.com/blog/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://annafilina.com/blog</link>
	<description>I fix stuff</description>
	<lastBuildDate>Thu, 17 May 2012 19:58:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Profiling MySQL Queries &#8211; Part 1</title>
		<link>http://annafilina.com/blog/profiling-mysql-queries-1/</link>
		<comments>http://annafilina.com/blog/profiling-mysql-queries-1/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 14:52:02 +0000</pubDate>
		<dc:creator>Anna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://annafilina.com/blog/?p=723</guid>
		<description><![CDATA[You website is slow. You suspect MySQL queries are slow, but don&#8217;t know where to begin. This article, aimed at intermediate developers, will present my methodology and serve as a starting point for first-timers. I won&#8217;t go in-depth, only cover some of the basics.
Turn On the Slow Query Log
I once had a server with 7.1K<div><a href="http://annafilina.com/blog/profiling-mysql-queries-1/">Read the rest...</a></div><br />]]></description>
			<content:encoded><![CDATA[<p>You website is slow. You suspect MySQL queries are slow, but don&#8217;t know where to begin. This article, aimed at intermediate developers, will present my methodology and serve as a starting point for first-timers. I won&#8217;t go in-depth, only cover some of the basics.</p>
<h3>Turn On the Slow Query Log</h3>
<p>I once had a server with 7.1K slow queries. Here&#8217;s how to see which queries are slow:</p>
<ol>
<li>Find the configuration file named my.cnf</li>
<li>Configure the location of the file where to log the queries, and set the minimum time, in seconds, that the query should run to be considered &#8220;slow&#8221;.<br />
log-slow-queries = /var/log/mysql/mysql-slow.log<br />
long_query_time = 1</li>
<li> Restart MySQL and start poking around your application (or run automated tests, if you have written any).</li>
</ol>
<div id="_mcePaste">As you use your application, the log file will start filling. I usually document the query variations I try and clock the query with each change to see which ones had the most impact. Using EXPLAIN EXTENDED can help you pinpoint where you are losing most of your performance in a query. I will cover this in detail in the next article.</div>
<div>Note: if you ever see queries like these SELECT /*!40001 SQL_NO_CACHE */ * FROM `table_name`, they are usually associated with a mysqldump command, and not with a query from within your application.</div>
<h3>Inspect Server Statistics</h3>
<p>I know of two ways to view server stats:</p>
<ol>
<li>by running the command SHOW STATUS; in MySQL command-line,</li>
<li>by clicking on the Status tab in phpMyAdmin</li>
</ol>
<p>Example: select_full_join must be 0. If not, the description recommends me to check my table indices. Try checking these stats on a production server, where the load is more realistic, and some of the red flags will only be raised when you have many concurrent users.</p>
<p>If you run into high numbers in the innodb_row_lock group, you can use the InnoDB monitor to check in real-time which tables are locked. Note that if too few users are using the application, this monitor may not show any rows. SHOW INNODB STATUS;</p>
<p>If you are not sure why certain values are too high or how you can improve them, search for the variable names online. I always document the values before and after I make optimization changes.</p>
<h3>Conclusion</h3>
<p>This should give you a starting point to begin profiling your queries. Not all the problems can be solved with proper queries; be ready to look into hardware, configuration and table structure/indices. Happy profiling!</p>
<p>In my next article, I will talk about the usage of EXPLAIN.</p>
]]></content:encoded>
			<wfw:commentRss>http://annafilina.com/blog/profiling-mysql-queries-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>doctrine:insert-sql for MAMP users</title>
		<link>http://annafilina.com/blog/doctrine-and-mamp/</link>
		<comments>http://annafilina.com/blog/doctrine-and-mamp/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 01:51:55 +0000</pubDate>
		<dc:creator>Anna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[mac os]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://annafilina.com/blog/?p=319</guid>
		<description><![CDATA[One of my computers has MAMP installed. I was trying to build a database schema from a YAML file. When time came to insert the SQL using&#8230;
&#62;php symfony doctrine:insert-sql
the following error message appeared:
&#62;Couldn&#8217;t locate driver named mysql
MySQL worked fine on this computer for many years so a missing driver was out of the question. After<div><a href="http://annafilina.com/blog/doctrine-and-mamp/">Read the rest...</a></div><br />]]></description>
			<content:encoded><![CDATA[<p>One of my computers has MAMP installed. I was trying to build a database schema from a YAML file. When time came to insert the SQL using&#8230;</p>
<p>&gt;php symfony doctrine:insert-sql</p>
<p>the following error message appeared:</p>
<p>&gt;Couldn&#8217;t locate driver named mysql</p>
<p>MySQL worked fine on this computer for many years so a missing driver was out of the question. After some thinking I realized that the command &#8220;php&#8221; actually refers to OS X version of php and not the one that ships with MAMP. Since I was too lazy to properly configure the extensions for the OS X version, I simply pointed the &#8220;php&#8221; command to the MAMP version using the following line:</p>
<p>&gt;alias php=&#8217;/Applications/MAMP/bin/php5/bin/php&#8217;</p>
<p>I ran the symfony command again and it worked perfectly!</p>
]]></content:encoded>
			<wfw:commentRss>http://annafilina.com/blog/doctrine-and-mamp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

