<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Feature Idea:  Finding columns which query needs to access</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/</link>
	<description>Everything about MySQL Performance</description>
	<pubDate>Tue, 02 Dec 2008 12:45:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Andrisi</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-25741</link>
		<dc:creator>Andrisi</dc:creator>
		<pubDate>Fri, 29 Dec 2006 17:44:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-25741</guid>
		<description>Good idea. Does not have to be human-readable. Would be useful in many client applications, that do complex user-defined queries, or ones doing editing with auto-build forms.</description>
		<content:encoded><![CDATA[<p>Good idea. Does not have to be human-readable. Would be useful in many client applications, that do complex user-defined queries, or ones doing editing with auto-build forms.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-15558</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Sat, 25 Nov 2006 23:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-15558</guid>
		<description>Thanks Philip,

This would be cool.   You can't get parser to be equivalent to MySQL parser in all cases as there are different versions and even different MySQL Server settings may change things. But it should be good enough for most cases.</description>
		<content:encoded><![CDATA[<p>Thanks Philip,</p>
<p>This would be cool.   You can&#8217;t get parser to be equivalent to MySQL parser in all cases as there are different versions and even different MySQL Server settings may change things. But it should be good enough for most cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip Stoev</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-15557</link>
		<dc:creator>Philip Stoev</dc:creator>
		<pubDate>Sat, 25 Nov 2006 23:00:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-15557</guid>
		<description>Hello, the MySQL parser has been yanked out and is now available as a separate Perl CPAN module, DBIx::MyParse. The current downloadable version has considerable limitations, however I am working on a new one that should parse any and all SELECTS that MySQL accepts. Once I get there, I will try to provide code that dumps the list of columns.</description>
		<content:encoded><![CDATA[<p>Hello, the MySQL parser has been yanked out and is now available as a separate Perl CPAN module, DBIx::MyParse. The current downloadable version has considerable limitations, however I am working on a new one that should parse any and all SELECTS that MySQL accepts. Once I get there, I will try to provide code that dumps the list of columns.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-12920</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Tue, 21 Nov 2006 08:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-12920</guid>
		<description>To write a script you need infrastructure on MySQL Server side still.

You can't really  write full query parser or reliably check which clauses are resolved which way. 

I do not really care if it is part of explain or available some other way.</description>
		<content:encoded><![CDATA[<p>To write a script you need infrastructure on MySQL Server side still.</p>
<p>You can&#8217;t really  write full query parser or reliably check which clauses are resolved which way. </p>
<p>I do not really care if it is part of explain or available some other way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Apachez</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-12873</link>
		<dc:creator>Apachez</dc:creator>
		<pubDate>Tue, 21 Nov 2006 05:59:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-12873</guid>
		<description>Does it have to be an extension to EXPLAIN?

A standalone script (say written in perl or so) would be for me more interresting. This way you could give the script various queries and it will spit out suggestions for indexes needed. Of course in the longer run it would be interresting to have it also available like EXPLAIN EXTENDED or something...</description>
		<content:encoded><![CDATA[<p>Does it have to be an extension to EXPLAIN?</p>
<p>A standalone script (say written in perl or so) would be for me more interresting. This way you could give the script various queries and it will spit out suggestions for indexes needed. Of course in the longer run it would be interresting to have it also available like EXPLAIN EXTENDED or something&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-12547</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 20 Nov 2006 16:13:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-12547</guid>
		<description>Sergey, 

You can run EXPLAIN ... \G in which case number of columns is not the problem any more. 

Adding two columns will be great, first listing columns which are used from the table and second listing where/on clauses applying to this table and how they are resolved, something like 

SELECT count(*) FROM A,B WHERE A.ID=B.ID and A.C&gt;5 and B.D&gt;6;

A: 
Used_Columns:  ID,C
Checks:  C&gt;5(range)

B:
Used_Columns:  ID,D
Checks:  ID=A.ID(ref), D&gt;6(row) 


This would allow to very easy to see which of the checks are not using index which are great candidates for optimization.</description>
		<content:encoded><![CDATA[<p>Sergey, </p>
<p>You can run EXPLAIN &#8230; \G in which case number of columns is not the problem any more. </p>
<p>Adding two columns will be great, first listing columns which are used from the table and second listing where/on clauses applying to this table and how they are resolved, something like </p>
<p>SELECT count(*) FROM A,B WHERE A.ID=B.ID and A.C>5 and B.D>6;</p>
<p>A:<br />
Used_Columns:  ID,C<br />
Checks:  C>5(range)</p>
<p>B:<br />
Used_Columns:  ID,D<br />
Checks:  ID=A.ID(ref), D>6(row) </p>
<p>This would allow to very easy to see which of the checks are not using index which are great candidates for optimization.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-12520</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Mon, 20 Nov 2006 16:02:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-12520</guid>
		<description>Roland,

I think it would be good, however I'm not sure passing query text is good idea. Might be EXPLAIN can simply feel these tables ready to use or something similar. 

The problem with such solution is - it will be unlikely implemented any time soon as it not that trivial. 

The other problem it may be a bit complicated to use - some people hate SHOW statements but they are much easier to use compared to information schema :)</description>
		<content:encoded><![CDATA[<p>Roland,</p>
<p>I think it would be good, however I&#8217;m not sure passing query text is good idea. Might be EXPLAIN can simply feel these tables ready to use or something similar. </p>
<p>The problem with such solution is - it will be unlikely implemented any time soon as it not that trivial. </p>
<p>The other problem it may be a bit complicated to use - some people hate SHOW statements but they are much easier to use compared to information schema <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Bouman</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-11055</link>
		<dc:creator>Roland Bouman</dc:creator>
		<pubDate>Sat, 18 Nov 2006 10:45:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-11055</guid>
		<description>Extra note: 
People I have told about this idea usually first say: "Nah this ugly, does not make sense, why pass the statement as a string, you should have a SHOW command rather than this, etc."

Well, first: it makes as much sense as EXPLAIN. There too, you feed an expression, and you get a resultset back. 
second: you cannot join against a SHOW command. Joining is good, you can use it then to parse the code from existing VIEW and PROCEDURE objects via the corresponding tables in he information schema.
third, it makes sense to pass it as a string. That way you can join to VIEW_DEFINITION and ROUTINE_DEFINITION etc columns in the information_schema VIEWS and ROUTINES columns

More purposes: refactoring code (renaming identifiers etc) but then the parse_tree table would also need the exact string position info.</description>
		<content:encoded><![CDATA[<p>Extra note:<br />
People I have told about this idea usually first say: &#8220;Nah this ugly, does not make sense, why pass the statement as a string, you should have a SHOW command rather than this, etc.&#8221;</p>
<p>Well, first: it makes as much sense as EXPLAIN. There too, you feed an expression, and you get a resultset back.<br />
second: you cannot join against a SHOW command. Joining is good, you can use it then to parse the code from existing VIEW and PROCEDURE objects via the corresponding tables in he information schema.<br />
third, it makes sense to pass it as a string. That way you can join to VIEW_DEFINITION and ROUTINE_DEFINITION etc columns in the information_schema VIEWS and ROUTINES columns</p>
<p>More purposes: refactoring code (renaming identifiers etc) but then the parse_tree table would also need the exact string position info.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Bouman</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-11053</link>
		<dc:creator>Roland Bouman</dc:creator>
		<pubDate>Sat, 18 Nov 2006 10:36:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-11053</guid>
		<description>I would very much like a pseudo table in the information_schema like this:

information_schema.parse_tree(
    query_text              text          -- query text for which the parse tree is given
,   id                      int unsigned  -- id for this node
,   parent_id               int unsigned  -- id of the parent node (implements adjacency list)
,   position                int unsigned  -- position of this node within the sibling nodes
,   lft                     int unsigned  -- nested set implementation
,   rgt                     int unsigned  -- nested set implementation
,   node_type               enum('identifier','constant',...) -- reference to syntax production rule
,   node_text               text          -- substring of query_Text that is parsed
)

THe usage would be like this:

select *
from   information_schema.parse_tree
where  query_text = 'select col1,col2 from aTable where col3 = ''bla'''
;

What would happen is that the parse_tree table would parse the query_text expression, and generate rows for all the nodes in the parse tree.

The nice thing about this table is that you could use for many more things, such as
-discover dependencies between views and tables
-discover dependencies between procedures and other procedures 

and...and..

Anyway, what do you think?</description>
		<content:encoded><![CDATA[<p>I would very much like a pseudo table in the information_schema like this:</p>
<p>information_schema.parse_tree(<br />
    query_text              text          &#8212; query text for which the parse tree is given<br />
,   id                      int unsigned  &#8212; id for this node<br />
,   parent_id               int unsigned  &#8212; id of the parent node (implements adjacency list)<br />
,   position                int unsigned  &#8212; position of this node within the sibling nodes<br />
,   lft                     int unsigned  &#8212; nested set implementation<br />
,   rgt                     int unsigned  &#8212; nested set implementation<br />
,   node_type               enum(&#8217;identifier&#8217;,'constant&#8217;,&#8230;) &#8212; reference to syntax production rule<br />
,   node_text               text          &#8212; substring of query_Text that is parsed<br />
)</p>
<p>THe usage would be like this:</p>
<p>select *<br />
from   information_schema.parse_tree<br />
where  query_text = &#8217;select col1,col2 from aTable where col3 = &#8221;bla&#8221;&#8217;<br />
;</p>
<p>What would happen is that the parse_tree table would parse the query_text expression, and generate rows for all the nodes in the parse tree.</p>
<p>The nice thing about this table is that you could use for many more things, such as<br />
-discover dependencies between views and tables<br />
-discover dependencies between procedures and other procedures </p>
<p>and&#8230;and..</p>
<p>Anyway, what do you think?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-10756</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Fri, 17 Nov 2006 21:50:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/17/feature-idea-finding-columns-which-query-needs-to-access/#comment-10756</guid>
		<description>Thank you Sergey, 

Yes I guess it can be used together with some parser to provide some readable output.   Being readable is important here as you already can manually dig such info it just takes a lot of effort. 

It would be also nice to be able to see which where clauses are  resolved doing index lookups and which are post-filtering.</description>
		<content:encoded><![CDATA[<p>Thank you Sergey, </p>
<p>Yes I guess it can be used together with some parser to provide some readable output.   Being readable is important here as you already can manually dig such info it just takes a lot of effort. </p>
<p>It would be also nice to be able to see which where clauses are  resolved doing index lookups and which are post-filtering.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
