<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MySQL VIEW as performance troublemaker</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 21 Nov 2009 05:23:57 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jesse Price</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-650600</link>
		<dc:creator>Jesse Price</dc:creator>
		<pubDate>Wed, 09 Sep 2009 12:31:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-650600</guid>
		<description>Hmm, it appears that using views which could be a quicker way to make db calls especially in joins and subqueries... never realized how bad the performance is by using them. I wonder if this performance issue also occurs when creating triggers and stored procedures.</description>
		<content:encoded><![CDATA[<p>Hmm, it appears that using views which could be a quicker way to make db calls especially in joins and subqueries&#8230; never realized how bad the performance is by using them. I wonder if this performance issue also occurs when creating triggers and stored procedures.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baron Schwartz</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-638105</link>
		<dc:creator>Baron Schwartz</dc:creator>
		<pubDate>Mon, 24 Aug 2009 17:55:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-638105</guid>
		<description>Blakkky, you should learn the execution plan differences between joins and correlated subqueries.</description>
		<content:encoded><![CDATA[<p>Blakkky, you should learn the execution plan differences between joins and correlated subqueries.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blakkky</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-638069</link>
		<dc:creator>Blakkky</dc:creator>
		<pubDate>Mon, 24 Aug 2009 16:19:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-638069</guid>
		<description>LOL, very useless article!

Author try to compare two uncompirable things!
Look here: Simple select is slower then view-select (ROFL):
==================================================
Simple select:
mysql&gt; select count(*) from (select * from comments where user_id in (select user_id from comments where user_id = 5 group by user_id)) t2;
+----------+
&#124; count(*) &#124;
+----------+
&#124;      100 &#124; 
+----------+
1 row in set (3.71 sec)


And from VIEW (CREATE VIEW user_counts AS SELECT * FROM comments):
mysql&gt; select count(*) from user_counts where user_id = 5;
+----------+
&#124; count(*) &#124;
+----------+
&#124;      100 &#124; 
+----------+
1 row in set (0.00 sec)
==================================================

Author&#039;s problem NOT IN VIEW at all, but in using a view for non-view-based operations!

VIEW - mechanism to make a pseudo-tables for database users (for example, to make four different client lists based on three tables (account, client, client-address) tables: client&#039;s names list, client&#039;s address list, client&#039;s detail info list. On this lists client-side-software maps grids, combo-boxes and other.

In author&#039;s example, VIEW works slowly ONLY AND ONLY BECOUSE autor use a GROUP BY statement in VIEW!

PS: sorry for my english, i&#039;m not from english-speaking country :)</description>
		<content:encoded><![CDATA[<p>LOL, very useless article!</p>
<p>Author try to compare two uncompirable things!<br />
Look here: Simple select is slower then view-select (ROFL):<br />
==================================================<br />
Simple select:<br />
mysql&gt; select count(*) from (select * from comments where user_id in (select user_id from comments where user_id = 5 group by user_id)) t2;<br />
+&#8212;&#8212;&#8212;-+<br />
| count(*) |<br />
+&#8212;&#8212;&#8212;-+<br />
|      100 |<br />
+&#8212;&#8212;&#8212;-+<br />
1 row in set (3.71 sec)</p>
<p>And from VIEW (CREATE VIEW user_counts AS SELECT * FROM comments):<br />
mysql&gt; select count(*) from user_counts where user_id = 5;<br />
+&#8212;&#8212;&#8212;-+<br />
| count(*) |<br />
+&#8212;&#8212;&#8212;-+<br />
|      100 |<br />
+&#8212;&#8212;&#8212;-+<br />
1 row in set (0.00 sec)<br />
==================================================</p>
<p>Author&#8217;s problem NOT IN VIEW at all, but in using a view for non-view-based operations!</p>
<p>VIEW &#8211; mechanism to make a pseudo-tables for database users (for example, to make four different client lists based on three tables (account, client, client-address) tables: client&#8217;s names list, client&#8217;s address list, client&#8217;s detail info list. On this lists client-side-software maps grids, combo-boxes and other.</p>
<p>In author&#8217;s example, VIEW works slowly ONLY AND ONLY BECOUSE autor use a GROUP BY statement in VIEW!</p>
<p>PS: sorry for my english, i&#8217;m not from english-speaking country <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Enabling Implicit Cast From Integer To Boolean in PostgreSQL &#124; chrisspenblog</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-632332</link>
		<dc:creator>Enabling Implicit Cast From Integer To Boolean in PostgreSQL &#124; chrisspenblog</dc:creator>
		<pubDate>Tue, 18 Aug 2009 17:36:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-632332</guid>
		<description>[...] complicated queries, and I&#8217;m running into a few obnoxious limitations, mostly involving known view performance problems. I&#8217;ve decided to start testing the waters in PostgreSQL, so I tried importing my data into PG [...]</description>
		<content:encoded><![CDATA[<p>[...] complicated queries, and I&#8217;m running into a few obnoxious limitations, mostly involving known view performance problems. I&#8217;ve decided to start testing the waters in PostgreSQL, so I tried importing my data into PG [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: View vs. Join - php.de</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-509486</link>
		<dc:creator>View vs. Join - php.de</dc:creator>
		<pubDate>Tue, 17 Mar 2009 06:58:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-509486</guid>
		<description>[...] @dsmcg: Meinst Du den &quot;Sonderfall&quot;, dass Du immer (oder zumindest sehr oft) das exakt selbe JOIN ohne veränderliche Parameter ausführst? Dann könnte Dir ein View zwei Vorteile bieten: Du musst Dich nicht auf den Query Cache verlassen, da der Query Plan getrennt und persistent abgespeichert werden könnte. Und Du verbirgst die eigentlichen Datenquellen vor der Applikation. Wenn Du Dich also entschließen solltest, dass die Datenstruktur zu kompliziert ist und Du den Aufbau der Datenbank ändern willst, musst Du die Applikation nicht anpassen. Soviel zur Theorie... in der Praxis sieht das gleich noch mal anders aus. Bei handgepflegten, handoptimierten (Oracle-)Datenbanken kann das richtig Klasse sein. Wenn Du den Datenbankserver einfach machen lässt, kannst Du schnell unerwartete Falschhälse schaffen, siehe zum Beispiel MySQL VIEW as performance troublemaker &#124; MySQL Performance Blog [...]</description>
		<content:encoded><![CDATA[<p>[...] @dsmcg: Meinst Du den &quot;Sonderfall&quot;, dass Du immer (oder zumindest sehr oft) das exakt selbe JOIN ohne veränderliche Parameter ausführst? Dann könnte Dir ein View zwei Vorteile bieten: Du musst Dich nicht auf den Query Cache verlassen, da der Query Plan getrennt und persistent abgespeichert werden könnte. Und Du verbirgst die eigentlichen Datenquellen vor der Applikation. Wenn Du Dich also entschließen solltest, dass die Datenstruktur zu kompliziert ist und Du den Aufbau der Datenbank ändern willst, musst Du die Applikation nicht anpassen. Soviel zur Theorie&#8230; in der Praxis sieht das gleich noch mal anders aus. Bei handgepflegten, handoptimierten (Oracle-)Datenbanken kann das richtig Klasse sein. Wenn Du den Datenbankserver einfach machen lässt, kannst Du schnell unerwartete Falschhälse schaffen, siehe zum Beispiel MySQL VIEW as performance troublemaker | MySQL Performance Blog [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dendie</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-488061</link>
		<dc:creator>dendie</dc:creator>
		<pubDate>Tue, 24 Feb 2009 15:32:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-488061</guid>
		<description>nice articel... thanks for your backmarking... :)</description>
		<content:encoded><![CDATA[<p>nice articel&#8230; thanks for your backmarking&#8230; <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dancing Mammoth :: Blog Archive :: Derived Attributes with UNION</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-343175</link>
		<dc:creator>Dancing Mammoth :: Blog Archive :: Derived Attributes with UNION</dc:creator>
		<pubDate>Sun, 10 Aug 2008 16:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-343175</guid>
		<description>[...] MySQL 5.0 or above, you won&#8217;t be able to mitigate this problem by using a VIEW.  MySQL is not very good at optimizing views. If there is not a one-to-one relationship between the rows of your view and the rows of the [...]</description>
		<content:encoded><![CDATA[<p>[...] MySQL 5.0 or above, you won&#8217;t be able to mitigate this problem by using a VIEW.  MySQL is not very good at optimizing views. If there is not a one-to-one relationship between the rows of your view and the rows of the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-327174</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sun, 13 Jul 2008 01:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-327174</guid>
		<description>This post makes it clear that indexes will not be used for views that use temporary tables. For views that do not use temporary tables, will &#039;joining&#039; or &#039;whereing&#039; on a column that is indexed in the underlying table use that index?</description>
		<content:encoded><![CDATA[<p>This post makes it clear that indexes will not be used for views that use temporary tables. For views that do not use temporary tables, will &#8216;joining&#8217; or &#8216;whereing&#8217; on a column that is indexed in the underlying table use that index?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bimal Poudel</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-290369</link>
		<dc:creator>Bimal Poudel</dc:creator>
		<pubDate>Wed, 30 Apr 2008 11:23:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-290369</guid>
		<description>Views meant to hide the complexities in the user&#039;s side. This helps you to shorten your query. Optimization is to be done from the MySQL server itself. But have you ever heard of something like indexing a view? Something else? As a developer, performance too matters.</description>
		<content:encoded><![CDATA[<p>Views meant to hide the complexities in the user&#8217;s side. This helps you to shorten your query. Optimization is to be done from the MySQL server itself. But have you ever heard of something like indexing a view? Something else? As a developer, performance too matters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/comment-page-1/#comment-272644</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 10 Apr 2008 13:50:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2007/08/12/mysql-view-as-performance-troublemaker/#comment-272644</guid>
		<description>Ascanio and others: Try using Stored Procedure, for this example.

DELIMITER $$
DROP PROCEDURE IF EXISTS `test2`.`user_count` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `user_count`(param1 int)
BEGIN
SELECT count(*) FROM comments WHERE user_id=param1; 
END $$
DELIMITER ;

Run the above code
then CALL user_count(5);  It will run SELECT count(*) FROM comments WHERE user_id=5; and just as fast as the straight select (from my testing less than 0.001 milisecond difference, sometimes the CALL was faster, but thats just due to random flux you might notice a difference if you were making thousands of calls a second..</description>
		<content:encoded><![CDATA[<p>Ascanio and others: Try using Stored Procedure, for this example.</p>
<p>DELIMITER $$<br />
DROP PROCEDURE IF EXISTS `test2`.`user_count` $$<br />
CREATE DEFINER=`root`@`localhost` PROCEDURE `user_count`(param1 int)<br />
BEGIN<br />
SELECT count(*) FROM comments WHERE user_id=param1;<br />
END $$<br />
DELIMITER ;</p>
<p>Run the above code<br />
then CALL user_count(5);  It will run SELECT count(*) FROM comments WHERE user_id=5; and just as fast as the straight select (from my testing less than 0.001 milisecond difference, sometimes the CALL was faster, but thats just due to random flux you might notice a difference if you were making thousands of calls a second..</p>
]]></content:encoded>
	</item>
</channel>
</rss>
