<?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>Xaprb &#187; Heuristics</title>
	<atom:link href="http://www.xaprb.com/blog/tag/heuristics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 03:58:56 +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>Try mk-query-advisor, a new Maatkit tool</title>
		<link>http://www.xaprb.com/blog/2010/03/16/try-mk-query-advisor-a-new-maatkit-tool/</link>
		<comments>http://www.xaprb.com/blog/2010/03/16/try-mk-query-advisor-a-new-maatkit-tool/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 00:48:31 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[Maatkit]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Heuristics]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1687</guid>
		<description><![CDATA[We have an early draft of a new tool available for you to use and test. It uses heuristics to find problems in SQL. Please use it and give feedback! Here&#8217;s how: $ wget http://www.maatkit.org/trunk/mk-query-advisor $ perl mk-query-advisor /var/log/mysql/slow.log By default it consumes a log file in MySQL&#8217;s slow query log format, but it can [...]


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2011/05/10/new-maatkit-tool-mk-table-usage/' rel='bookmark' title='Permanent Link: New Maatkit tool: mk-table-usage'>New Maatkit tool: mk-table-usage</a></li>
<li><a href='http://www.xaprb.com/blog/2010/05/10/new-maatkit-tool-to-compute-index-usage/' rel='bookmark' title='Permanent Link: New Maatkit tool to compute index usage'>New Maatkit tool to compute index usage</a></li>
<li><a href='http://www.xaprb.com/blog/2010/07/10/aspersas-mysql-summary-tool/' rel='bookmark' title='Permanent Link: Aspersa&#8217;s mysql-summary tool'>Aspersa&#8217;s mysql-summary tool</a></li>
<li><a href='http://www.xaprb.com/blog/2009/05/29/seeking-input-for-a-new-tool-to-verify-mysql-upgrades/' rel='bookmark' title='Permanent Link: Seeking input for a new tool to verify MySQL upgrades'>Seeking input for a new tool to verify MySQL upgrades</a></li>
<li><a href='http://www.xaprb.com/blog/2011/02/05/new-aspersa-io-analysis-tool-diskstats/' rel='bookmark' title='Permanent Link: New Aspersa I/O analysis tool, diskstats'>New Aspersa I/O analysis tool, diskstats</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.maatkit.org/">We</a> have an early draft of a new tool available for you to use and test.  It uses heuristics to find problems in SQL.  Please use it and give feedback!  Here&#8217;s how:</p>

<code><pre>$ wget http://www.maatkit.org/trunk/mk-query-advisor
$ perl mk-query-advisor /var/log/mysql/slow.log
</pre></code>

<p>By default it consumes a log file in MySQL&#8217;s slow query log format, but it can also parse the general-log format, and if you have any other kind of log you can feed it through mk-query-digest to transform the log into something it can recognize.  Tell me if you&#8217;d be able to spot the mixture of join styles and use of leading % wildcards in the following query without help:</p>

<code><pre>
# Query ID 0x643E813A9ABDA151 at byte 2001701
# CRIT JOI.001 Mixing comma and ANSI joins.
# WARN ARG.001 Argument with leading wildcard.
SELECT `rhubarb_series_title`.`id`, `rhubarb_series_title`.`series_id`,
`rhubarb_series_title`.`title`, `rhubarb_series_title`.`url`,
`rhubarb_series_title`.`type`, `rhubarb_series`.`id`, `rhubarb_series`.`title`,
`rhubarb_series`.`alt_title`, `rhubarb_series`.`url`, `rhubarb_series`.`aka`,
`rhubarb_series`.`author`, `rhubarb_series`.`artist`,
`rhubarb_series`.`summary`, `rhubarb_series`.`logo`,
`rhubarb_series`.`logo_updated`, `rhubarb_series`.`us_publisher`,
`rhubarb_series`.`jp_publisher`, `rhubarb_series`.`start_date`,
`rhubarb_series`.`official_website`, `rhubarb_series`.`create_time`,
`rhubarb_series`.`modify_time`, `rhubarb_series`.`poster_id`,
`rhubarb_series`.`note`, `rhubarb_series`.`status`,
`rhubarb_series`.`status_note`, `rhubarb_series`.`suspended`,
`rhubarb_series`.`licensed`, `rhubarb_series`.`warning`,
`rhubarb_series`.`no_ads`, `rhubarb_series`.`orientation`,
`rhubarb_series`.`gen_js`, `rhubarb_series`.`image_pre`,
`rhubarb_series`.`views`, `rhubarb_series`.`rank`,
`rhubarb_series`.`last_chapter`, `rhubarb_series`.`last_updated`,
`rhubarb_series`.`bookmark_count`, `rhubarb_series`.`ad_pre`, `auth_user`.`id`,
`auth_user`.`username`, `auth_user`.`first_name`, `auth_user`.`last_name`,
`auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`,
`auth_user`.`is_active`, `auth_user`.`is_superuser`, `auth_user`.`last_login`,
`auth_user`.`date_joined` FROM `rhubarb_series_title` INNER JOIN
`rhubarb_series` AS `rhubarb_series_title__series` ON
`rhubarb_series_title`.`series_id` = `rhubarb_series_title__series`.`id` ,
`rhubarb_series`,  `auth_user` WHERE (`rhubarb_series_title__series`.`suspended`
= 0 AND `rhubarb_series_title__series`.`author` LIKE '%onetwo%' AND
`rhubarb_series_title__series`.`author` LIKE '%threefour%') AND
`rhubarb_series_title`.`series_id` = `rhubarb_series`.`id` AND
`rhubarb_series`.`poster_id` = `auth_user`.`id`
</pre></code>

<p>Yes, that&#8217;s a real query, slightly obfuscated.</p>

<p>If you find bugs, <a href="http://code.google.com/p/maatkit/issues/list">report them</a>.  If you find a &#8220;bad query&#8221; that doesn&#8217;t trigger any heuristic, <a href="http://code.google.com/p/maatkit/issues/list">report that too</a>.  We&#8217;re only getting started, but I feel sure that this tool will become a sort of best-practices advisor as we make it more capable.  The Google Code issue tracker has <a href="http://code.google.com/p/maatkit/issues/detail?id=861">a full initial spec</a>, and <a href="http://code.google.com/p/maatkit/wiki/mk_query_advisor">the wiki has a roadmap</a>.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2011/05/10/new-maatkit-tool-mk-table-usage/' rel='bookmark' title='Permanent Link: New Maatkit tool: mk-table-usage'>New Maatkit tool: mk-table-usage</a></li>
<li><a href='http://www.xaprb.com/blog/2010/05/10/new-maatkit-tool-to-compute-index-usage/' rel='bookmark' title='Permanent Link: New Maatkit tool to compute index usage'>New Maatkit tool to compute index usage</a></li>
<li><a href='http://www.xaprb.com/blog/2010/07/10/aspersas-mysql-summary-tool/' rel='bookmark' title='Permanent Link: Aspersa&#8217;s mysql-summary tool'>Aspersa&#8217;s mysql-summary tool</a></li>
<li><a href='http://www.xaprb.com/blog/2009/05/29/seeking-input-for-a-new-tool-to-verify-mysql-upgrades/' rel='bookmark' title='Permanent Link: Seeking input for a new tool to verify MySQL upgrades'>Seeking input for a new tool to verify MySQL upgrades</a></li>
<li><a href='http://www.xaprb.com/blog/2011/02/05/new-aspersa-io-analysis-tool-diskstats/' rel='bookmark' title='Permanent Link: New Aspersa I/O analysis tool, diskstats'>New Aspersa I/O analysis tool, diskstats</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2010/03/16/try-mk-query-advisor-a-new-maatkit-tool/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

