<?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>Glotzfisch.de &#187; mySQL</title>
	<atom:link href="http://www.glotzfisch.de/category/databases/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.glotzfisch.de</link>
	<description>If something does not work out the way you want it to - try something different</description>
	<lastBuildDate>Wed, 26 May 2010 08:43:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simulating a Materialised View in mySQL</title>
		<link>http://www.glotzfisch.de/simulating-a-materialised-view-in-mysql/</link>
		<comments>http://www.glotzfisch.de/simulating-a-materialised-view-in-mysql/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 14:37:38 +0000</pubDate>
		<dc:creator>Gabi</dc:creator>
				<category><![CDATA[mySQL]]></category>

		<guid isPermaLink="false">http://www.glotzfisch.de/?p=116</guid>
		<description><![CDATA[As mySQL does not support materialised views out of the box, I was looking for a work around. The most convincing one I found (because it only switches tables when the new one is readily filled) is: create your view v_name as needed. create a table having the same fields as your view and name [...]]]></description>
			<content:encoded><![CDATA[<p>As mySQL does not support materialised views out of the box, I was looking for a work around. The most convincing one I found (because it only switches tables when the new one is readily filled) is:</p>
<ol>
<li>create your view <code>v_name</code> as needed.</li>
<li>create a table having the same fields as your view and name it e.g. <code>mview_name</code></li>
<li>create a procedure to refill the table</li>
</ol>
<p>
<pre>
CREATE PROCEDURE update_mview_name ()
BEGIN
  DROP TABLE IF EXISTS new_mview_name;
  CREATE TABLE new_mview_name AS SELECT * from v_name;
  RENAME TABLE mview_name TO old_mview_name, new_mview_name TO mview_name;
  DROP TABLE IF EXISTS old_mview_name;
END;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.glotzfisch.de/simulating-a-materialised-view-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
