<?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>schmichael&#039;s blog &#187; SQL</title>
	<atom:link href="http://blog.schmichael.com/category/technology/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.schmichael.com</link>
	<description>good good study, day day up</description>
	<lastBuildDate>Wed, 16 May 2012 23:59:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Less Pagination, More More</title>
		<link>http://blog.schmichael.com/2010/07/16/less-pagination-more-more/</link>
		<comments>http://blog.schmichael.com/2010/07/16/less-pagination-more-more/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 00:30:58 +0000</pubDate>
		<dc:creator>Michael Schurter</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[cassandra]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[urbanairship]]></category>

		<guid isPermaLink="false">http://blog.schmichael.com/?p=827</guid>
		<description><![CDATA[We live in a brave new (to some) world of databases other than a relational database with a SQL interface. Normally end users never notice a difference, but the astute viewer may notice the slow demise of an old friend: &#8230; <a href="http://blog.schmichael.com/2010/07/16/less-pagination-more-more/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We live in a brave new (to some) world of databases other than a relational database with a SQL interface. Normally end users never notice a difference, but the astute viewer may notice the slow demise of an old friend: pagination.</p>
<p>Traditionally with SQL databases pagination has looked something like this:<br />
<img src="http://schmichael.com/files/pagination.png"/></p>
<p>There are previous and next links as well as links for jumping right to the beginning and end. Pretty boring stuff.</p>
<p>What&#8217;s interesting is that this standard interface is disappearing in favor of something like this:</p>
<p><em>Twitter</em><br />
<img src="http://schmichael.com/files/twitter-more.png"/></p>
<p><em>Facebook</em><br />
<img src="http://schmichael.com/files/facebook-more.png"/></p>
<p>And soon beta testers of <a href="http://blog.urbanairship.com/2010/05/25/android-delivers-push-notifications-are-here-to-stay/">Urban Airship&#8217;s push service for Android</a> will see a More link on the page that lists devices associated with their app:</p>
<p><img src="http://schmichael.com/files/apids-more.png"/></p>
<p>The simplest possible explanation for this dumbing down of pagination is that <strong>count (for total pages) and skip/offset are expensive operations.</strong></p>
<p>Not only are those operations expensive, but in eventually consistent databases, which many modern non-relational databases are, they&#8217;re extremely expensive, if not impossible, to perform.</p>
<p><strong>Cassandra</strong></p>
<p>At Urban Airship we, like Facebook, use <a href="http://cassandra.apache.org/">Cassandra</a>: a distributed column-based database. This deals two deadly blows to traditional pagination:</p>
<ol>
<li>No way to count columns in a row (without reading every column).</li>
<li>No way to skip by numeric offset (so you can&#8217;t say, skip to page 5).</li>
</ol>
<p>In Cassandra columns are ordered, so you start reading from the beginning and read N+1 columns where N is the number of items you&#8217;d like to display. The last column&#8217;s key is then used to determine whether the More link is enabled, and if so, what key to start the next &#8220;page&#8221; at. </p>
<p>Both of those are solvable problems if you really need them, but I would suspect you would end up creating a column count cache as well as some sort of table of contents for the various page offsets. Not what I want to spend my time implementing.</p>
<p>The fact of the matter is that for many use cases, a simple More button works just as well (if not better) than traditional pagination. It&#8217;s also far cheaper to implement, which means more developer time free to work on features and more hardware resources available to push your 140 character insights around the web.</p>
<p><strong>MongoDB</strong></p>
<p>I should note that MongoDB is fairly unique in the non-relational database world as its dynamic querying features include <a href="http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Count">count</a> and <a href="http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bskip%28%29%7D%7D">skip</a> operations. However, as with any database, you&#8217;ll want to make sure these queries hit indexes.</p>
<p>Sadly MongoDB currently doesn&#8217;t have the distributed features necessary to automatically handle data too big for a single server.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schmichael.com/2010/07/16/less-pagination-more-more/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fun with SQLObject and mxDateTime</title>
		<link>http://blog.schmichael.com/2007/11/29/fun-with-sqlobject-and-mxdatetime/</link>
		<comments>http://blog.schmichael.com/2007/11/29/fun-with-sqlobject-and-mxdatetime/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 00:03:23 +0000</pubDate>
		<dc:creator>Michael Schurter</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[cherrypy]]></category>
		<category><![CDATA[mxdatetime]]></category>
		<category><![CDATA[sqlobject]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://michael.susens-schurter.com/blog/2007/11/29/fun-with-sqlobject-and-mxdatetime/</guid>
		<description><![CDATA[I&#8217;m working on a small CherryPy web service that among other things saves timestamps to a database. The timestamp is in RFC 3339 format (like 2007-07-31T16:05:00.000-05:00), and I needed to store the timezone. Luckily mxDateTime and SQLObject&#8217;s DateTimeCol both support &#8230; <a href="http://blog.schmichael.com/2007/11/29/fun-with-sqlobject-and-mxdatetime/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a small <a href="http://cherrypy.org">CherryPy</a> web service that among other things saves timestamps to a database.  The timestamp is in <a href="http://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a> format (like <code>2007-07-31T16:05:00.000-05:00</code>), and I needed to store the timezone.</p>
<p>Luckily <a href="http://www.egenix.com/products/python/mxBase/mxDateTime/">mxDateTime</a> and SQLObject&#8217;s DateTimeCol both support full dates with times and time zone.  Unfortunately its not immediately obvious from <a href="http://sqlobject.org/SQLObject.html">SQLObject&#8217;s lackluster documentation</a> how to use mxDateTime instead of Python&#8217;s built-in datetime.</p>
<p>A little searching brought me to a mailing list post about <a href="http://pythonpaste.org/archives/message/20070410.064412.fa195fb7.en.html">how to use mxDateTime by default in SQLObject</a>.  (I don&#8217;t know why the sample code includes the conditional as I would think you&#8217;d want your code to outright fail if you&#8217;re unable to use the datetime library you expect.)</p>
<p>So my model&#8217;s code looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> sqlobject <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #ff7700;font-weight:bold;">from</span> sqlobject <span style="color: #ff7700;font-weight:bold;">import</span> col
&nbsp;
col.<span style="color: black;">default_datetime_implementation</span> = MXDATETIME_IMPLEMENTATION
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> Foo<span style="color: black;">&#40;</span>SQLObject<span style="color: black;">&#41;</span>:
    timestamp = DateTimeCol<span style="color: black;">&#40;</span>default=DateTimeCol.<span style="color: black;">now</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Then my parsing code looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> model
<span style="color: #ff7700;font-weight:bold;">from</span> mx <span style="color: #ff7700;font-weight:bold;">import</span> DateTime
&nbsp;
timestamp = <span style="color: #483d8b;">'2007-07-31T16:05:00.000-05:00'</span>
bar = model.<span style="color: black;">Foo</span><span style="color: black;">&#40;</span>timestamp=DateTime.<span style="color: black;">DateTimeFrom</span><span style="color: black;">&#40;</span>timestamp<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'UTC Timestamp:'</span>, bar.<span style="color: black;">timestamp</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Local Timestamp:'</span>, bar.<span style="color: black;">timestamp</span>.<span style="color: black;">localtime</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Basically once you use the magic line <code>col.default_datetime_implementation = MXDATETIME_IMPLEMENTATION</code>, everything Just Works.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schmichael.com/2007/11/29/fun-with-sqlobject-and-mxdatetime/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PostgreSQL 8.3 Beta</title>
		<link>http://blog.schmichael.com/2007/10/09/postgresql-83-beta/</link>
		<comments>http://blog.schmichael.com/2007/10/09/postgresql-83-beta/#comments</comments>
		<pubDate>Tue, 09 Oct 2007 14:24:25 +0000</pubDate>
		<dc:creator>Michael Schurter</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://michael.susens-schurter.com/blog/2007/10/09/postgresql-83-beta/</guid>
		<description><![CDATA[Warning: IANADBA I was just reading the release notes for PostgreSQL 8.3 beta1, and there&#8217;s quite a lot of exciting improvements coming: Full text search is now a built-in feature Support for the SQL/XML standard, including a new xml builtin &#8230; <a href="http://blog.schmichael.com/2007/10/09/postgresql-83-beta/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><small>Warning: <abbr title="I Am Not A DataBase Administrator">IANADBA</abbr></small><br />
I was just reading the <a href="http://www.postgresql.org/docs/8.3/static/release-8-3.html">release notes for PostgreSQL 8.3 beta1</a>, and there&#8217;s quite a lot of exciting improvements coming:</p>
<ul>
<li>Full text search is now a built-in feature</li>
<li>Support for the SQL/XML standard, including a new xml builtin data type <em>(For the enterprisy users)</em></li>
<li>enum data types <em>(I&#8217;m not a big fan of enums in a database, but lots of people like them.)</em></li>
<li>UUID data type, similar to that defined by <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>. <em>(Very useful feature in some clustering situations.  Some people even argue GUIDs/UUIDs should replace integer surrogate keys most of the time.)</em></li>
<li>ORDER BY &#8230; NULLS FIRST/LAST <em>(A minor little feature, but I remember wishing for it once upon a time.)</em></li>
<li>And some excellent performance improvements, especially if you&#8217;re data doesn&#8217;t have to be flushed to disk to finish a transaction (potentially dangerous, but acceptable for many use cases).</li>
</ul>
<p>While I haven&#8217;t had the pleasure of using PostgreSQL for a few months, I prefer it over MySQL and recommend it to anyone looking for an open source database with advanced features and excellent reliability.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schmichael.com/2007/10/09/postgresql-83-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal Database Maintenance Script</title>
		<link>http://blog.schmichael.com/2007/08/03/drupal-database-maintenance-script/</link>
		<comments>http://blog.schmichael.com/2007/08/03/drupal-database-maintenance-script/#comments</comments>
		<pubDate>Fri, 03 Aug 2007 16:10:20 +0000</pubDate>
		<dc:creator>Michael Schurter</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://michael.susens-schurter.com/blog/2007/08/03/drupal-database-maintenance-script/</guid>
		<description><![CDATA[I love Drupal, but its insistence on saving every session its ever created causes the sessions table to become massive. So I usually end up creating a shell script like the following: drupal-db-maint.sh (I posted a copy to pastebin since &#8230; <a href="http://blog.schmichael.com/2007/08/03/drupal-database-maintenance-script/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I love <a href="http://drupal.org">Drupal</a>, but its insistence on saving every session its ever created causes the <code>sessions</code> table to become massive.  So I usually end up creating a shell script like the following:</p>
<p><strong>drupal-db-maint.sh</strong> (I posted <a href="http://pastebin.ca/644472">a copy to pastebin</a> since WordPress makes the code impossible to read.)</p>
<div style="border: 1px solid #cccccc; margin: 2px; padding: 2px; font-family: monospace; font-size: 8pt; text-align: left">#!/bin/sh<br />
echo `date` &#8211; Starting Drupal database maintenance<br />
MYSQL_USERNAME=&#8217;<strong>insert your MySQL username here</strong>&#8216;<br />
MYSQL_PASSWORD=&#8217;<strong>insert your MySQL password here</strong>&#8216;<br />
MYSQL_DATABASE=&#8217;<strong>insert your database name here</strong>&#8216;</p>
<p># Note: 2592000 = sessions over 30 days old.<br />
# Adjust the timespan as desired.<br />
CLEAN_SESSIONS_SQL=&#8217;DELETE FROM `sessions` WHERE `timestamp` &lt; (UNIX_TIMESTAMP() &#8211; 2592000)&#8217;<br />
OPTIMIZE_CACHES_SQL=&#8217;OPTIMIZE TABLE `cache` , `cache_filter` , `cache_menu` , `cache_page` , `cache_views` , `sessions`&#8217;</p>
<p># Note: I have tons of modules installed.<br />
# I tried cleaning out their table names before posting, but you&#8217;ll want to double check this SQL.<br />
OPTIMIZE_REST_SQL=&#8217;OPTIMIZE TABLE `access` , `accesslog` , `aggregator_category` , `aggregator_category_feed` , `aggregator_category_item` , `aggregator_feed` , `aggregator_item` , `authmap` , `blocks` , `blocks_roles` , `boxes` , `client` , `client_system` , `comments` , `contact` , `files` , `file_revisions` , `filters` , `filter_formats` , `flood` , `history` , `invite` , `menu` , `node` , `node_access` , `node_comment_statistics` , `node_counter` , `node_revisions` , `node_type` , `permission` , `profile_fields` , `profile_values` , `role` , `search_dataset` , `search_index` , `search_total` , `sequences` , `system` , `term_data` , `term_hierarchy` , `term_node` , `term_relation` , `term_synonym` , `url_alias` , `users` , `users_roles` , `variable` , `vocabulary` , `vocabulary_node_types` , `watchdog`&#8217;</p>
<p># Note: I run this script on a Linode which has limited IO.<br />
# Adding a short wait between commands lessens the load on the server.<br />
SLEEP_TIME=5</p>
<p>echo $CLEAN_SESSIONS_SQL | mysql -u $MYSQL_USERNAME -p$MYSQL_PASSWORD $MYSQL_DATABASE<br />
sleep $SLEEP_TIME</p>
<p>echo $OPTIMIZE_CACHES_SQL | mysql -u $MYSQL_USERNAME -p$MYSQL_PASSWORD $MYSQL_DATABASE &gt; /dev/null<br />
sleep $SLEEP_TIME</p>
<p>echo $OPTIMIZE_REST_SQL | mysql -u $MYSQL_USERNAME -p$MYSQL_PASSWORD $MYSQL_DATABASE &gt; /dev/null</p>
<p>echo `date` &#8211; Done with Drupal database maintenance</p></div>
<p>Then just run <code>crontab -e</code> to edit your crontab and add a line similar to:<br />
<code>46  4  *   *   *     /path/to/drupal-db-maint.sh</code></p>
<p>That will optimize your database nightly at 4:46 AM server time (usually UTC).</p>
<p>If you don&#8217;t like my solution, there are plenty of <a href="http://tools.ourmedia.org/blog/markus_sandy/performance_and_a_new_module">more elegant session cleaning solutions out there</a>.  I&#8217;m just more comfortable writing shell scripts and crontabs than Drupal modules that use <a href="http://api.drupal.org/api/function/hook_cron/5">hook_cron</a>.</p>
<p><small>Posting code in WordPress so that its readable is pretty much impossible.  Any suggestions?</small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schmichael.com/2007/08/03/drupal-database-maintenance-script/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Debian Etch Released</title>
		<link>http://blog.schmichael.com/2007/04/08/debian-etch-released/</link>
		<comments>http://blog.schmichael.com/2007/04/08/debian-etch-released/#comments</comments>
		<pubDate>Sun, 08 Apr 2007 18:24:39 +0000</pubDate>
		<dc:creator>Michael Schurter</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Mono/.Net]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://michael.susens-schurter.com/blog/2007/04/08/debian-etch-released/</guid>
		<description><![CDATA[It appears Debian GNU/Linux 4.0, codenamed Etch, (quite a mouthful) has been released as the latest stable version of Debian. Go download it using BitTorrent to be cool. Tip #1:  You do not have to download all of the CDs, &#8230; <a href="http://blog.schmichael.com/2007/04/08/debian-etch-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It <a href="http://www.debian-administration.org/articles/514">appears</a> <a href="http://www.debian.org/releases/etch/releasenotes">Debian GNU/Linux 4.0, codenamed Etch,</a> (quite a mouthful) <a href="http://www.debian.org/News/2007/20070408">has been released as the latest stable version of Debian</a>.</p>
<p>Go <a href="http://www.debian.org/CD/torrent-cd/">download it using BitTorrent to be cool</a>.  <img src='http://blog.schmichael.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>Tip #1:</strong>  You do <em><strong>not</strong></em> have to download all of the CDs, just get one and Debian&#8217;s installer will download the rest.)</p>
<p>I&#8217;m a happy and loyal Debian user and strongly encourage any Linux power users to try out Etch.  <a href="http://www.ubuntu.com/">Ubuntu</a> is still my recommendation for users who want things to &#8220;Just Work.&#8221; However, I highly recommend Debian for any kind of server (file, print, application, database, web, e-mail).</p>
<p><strong>Tip #2:</strong> Check out <a href="http://www.debian-multimedia.org/">Debian Multimedia</a> for all of your proprietary codec needs!</p>
<p><strong>Mini-Review</strong></p>
<p>I&#8217;ve been using Etch (and Sid) for a while now, so its tough to do a real review from a &#8220;normal&#8221; end user&#8217;s perspective.</p>
<p>Some highlights:</p>
<ul>
<li>Developer&#8217;s should be happy as <a href="http://php.net/">PHP,</a> <a href="http://python.org/">Python</a>, <a href="http://mono-project.com/">Mono,</a> <a href="http://mysql.com/">MySQL,</a> and <a href="http://www.postgresql.org/">PostgreSQL</a> are all fairly up-to-date and extremely easy to install.</li>
<li><a href="http://www.gnome.org/">Gnome</a> is stable and speedy.</li>
<li>The <a href="http://wiki.debian.org/DebianInstaller/GUI">graphical installer</a> brings Debian out of the 1990s and offers tons of features.</li>
<li>As usual, Debian&#8217;s package repository is <em>huge</em>.  Forget vendor-supplied RPMs or custom installers, if its not in Debian&#8217;s repository (or Debian Multimedia), you probably don&#8217;t need it.  <img src='http://blog.schmichael.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ul>
<p>Some downsides:</p>
<ul>
<li>Relatively ancient version of the standard C library (2.3.6) means <a href="http://thomas.apestaart.org/log/?p=457">poor compatibility with 3rd party binaries</a> (which Debian has always hated anyway).</li>
<li>Gnome is 2 stable versions behind in Debian (2.14 vs. 2.18).  This is very frustrating as Gnome constantly produces nice incremental improvements.</li>
<li>Debian just isn&#8217;t as easy to use by default as Ubuntu.  Debian needs to install and integrate some of the more cutting edge desktop apps like <a href="http://beagle-project.org">Beagle</a>, <a href="http://www.gnome.org/projects/tomboy/">Tomboy</a>, <a href="http://raphael.slinckx.net/deskbar/">Deskbar</a>, and Ubuntu&#8217;s nicer package management interfaces.</li>
<li><a href="http://wiki.debian.org/SecureApt">Secure APT</a> is a <em>great</em> feature, but the error messages it can produce are going to scare the pants off of new users.  More effort needs to be made to integrate all of the various places user&#8217;s encounter public key crypto.  Right now its very schizophrenic and confusing: GPG errors are too common, and command line magic that even confuses me is necessary to add new repositories.</li>
<li>Not related to the release, Debian&#8217;s support system is a confusing jumble of web interfaces, mailing lists, IRC channels, and <a href="http://wiki.debian.org">an excellent wiki</a> (that I rarely remember to use).  Hopefully this is something a new <a href="http://wiki.debian.org/DebianProjectLeader?action=show&amp;redirect=DPL">Debian DPL</a> will address.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.schmichael.com/2007/04/08/debian-etch-released/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PostgreSQL Killed My Harddrive</title>
		<link>http://blog.schmichael.com/2007/03/14/postgresql-killed-my-harddrive/</link>
		<comments>http://blog.schmichael.com/2007/03/14/postgresql-killed-my-harddrive/#comments</comments>
		<pubDate>Wed, 14 Mar 2007 13:41:14 +0000</pubDate>
		<dc:creator>Michael Schurter</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://michael.susens-schurter.com/blog/2007/03/14/postgresql-killed-my-harddrive/</guid>
		<description><![CDATA[The harddrive died in the server that dumps our firewall&#8217;s syslog output into a nice PostgreSQL database for easy reporting. PostgreSQL didn&#8217;t do anything evil in order to kill the drive, but because it syncs data to the harddrive for &#8230; <a href="http://blog.schmichael.com/2007/03/14/postgresql-killed-my-harddrive/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The harddrive died in the server that dumps our firewall&#8217;s syslog output into a nice <a href="http://www.postgresql.org">PostgreSQL</a> database for easy reporting.  PostgreSQL didn&#8217;t do anything evil in order to kill the drive, but because <a href="http://developer.postgresql.org/pgdocs/postgres/runtime-config-wal.html">it syncs data to the harddrive for safety</a>, it kept my ancient server&#8217;s harddrive spinning 24/7.</p>
<p>I should mention this was my fault.  I really should have <a href="http://www.postgresql.org/docs/8.1/interactive/runtime-config-wal.html">turned fsync off</a> to let the server cache the trickle of ICMP packets that keep our firewall awake all night.  Instead the old Quantum Fireball Plus LM harddrive wrote every byte right as it came in.</p>
<p>Luckily the harddrive still worked enough that I could attach it to another computer via a IDE-USB adapter and copy off any data I wanted to keep.</p>
<p>Below are the SMART statistics for the drive as collected by <a href="http://smartmontools.sourceforge.net/">smartmontools</a> and <a href="http://munin.projects.linpro.no/">munin</a>.  As I was able to retrieve data off the disk, I would say SMART did its job even if it didn&#8217;t give me much warning.</p>
<p><a href="http://michael.susens-schurter.com/blog/wp-content/uploads/2007/03/moodletremontlocal-smart_hda-day.png" title="moodletremontlocal-smart_hda-day.png"><img src="http://michael.susens-schurter.com/blog/wp-content/uploads/2007/03/moodletremontlocal-smart_hda-day.png" alt="moodletremontlocal-smart_hda-day.png" /></a><br />
<a href="http://michael.susens-schurter.com/blog/wp-content/uploads/2007/03/moodletremontlocal-smart_hda-month.png" title="moodletremontlocal-smart_hda-month.png"><img src="http://michael.susens-schurter.com/blog/wp-content/uploads/2007/03/moodletremontlocal-smart_hda-month.png" alt="moodletremontlocal-smart_hda-month.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.schmichael.com/2007/03/14/postgresql-killed-my-harddrive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

