<?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>Labix Blog &#187; PostgreSQL</title>
	<atom:link href="http://blog.labix.org/tag/postgresql/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.labix.org</link>
	<description>by Gustavo Niemeyer</description>
	<lastBuildDate>Mon, 16 Jan 2012 04:02:51 +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>Ensemble, Go, and MongoDB at Canonical</title>
		<link>http://blog.labix.org/2011/08/05/ensemble-go-and-mongodb-at-canonical</link>
		<comments>http://blog.labix.org/2011/08/05/ensemble-go-and-mongodb-at-canonical#comments</comments>
		<pubDate>Fri, 05 Aug 2011 03:49:14 +0000</pubDate>
		<dc:creator>Gustavo Niemeyer</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.labix.org/?p=706</guid>
		<description><![CDATA[About 1 year after development started in Ensemble, today the stars finally aligned just the right way (review queue mostly empty, no other pressing needs, etc) for me to start writing the specification about the repository system we&#8217;ve been jointly &#8230; <a href="http://blog.labix.org/2011/08/05/ensemble-go-and-mongodb-at-canonical">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>About 1 year after development started in <a href="https://ensemble.ubuntu.com">Ensemble</a>, today the stars finally aligned just the right way (review queue mostly empty, no other pressing needs, etc) for me to start writing the specification about the repository system we&#8217;ve been jointly planning for a long time. This is the system that the Ensemble client will communicate with for discovering which <a href="https://ensemble.ubuntu.com/docs/formula.html">formulas</a> are available, for publishing new formulas, for obtaining formula files for deployment, and so on.</p>
<p><span id="more-706"></span>We of course would have liked for this part of the project to have been specified and written a while ago, but unfortunately that wasn&#8217;t possible for several reasons. That said, there are also good sides of having an important piece flying around in minds and conversations for such a long time: sitting down to specify the system and describe the inner-working details has been a breeze. Even details such as the namespacing of formulas, which hasn&#8217;t been entirely clear in my mind, was just streamed into the document as the ideas we&#8217;ve been evolving finally got together in a written form. </p>
<p>One curious detail: this is the first long term project at <a href="https://www.canonical.com">Canonical</a> that will be developed in <a href="http://golang.org">Go</a>, rather than Python or C/C++, which are the most used languages for projects within Canonical. Not only that, but we&#8217;ll also be using <a href="http://www.mongodb.org">MongoDB</a> for a change, rather than the traditional <a href="http://www.postgresql.com">PostgreSQL</a>, and will also use (you guessed) the <a href="http://labix.org/mgo">mgo driver</a> which I&#8217;ve been pushing entirely as a personal project for about 8 months now.</p>
<p>Naturally, with so many moving parts that are new to the company culture, this is still being seen as a closely watched experiment. Still, this makes me highly excited, because when I started developing mgo, the MongoDB driver for Go, my hopes that the Go, MongoDB, and mgo trio would eventually be used at Canonical were very low, precisely because they were all alien to the culture. We only got here after quite a lot of internal debate, experiments, and trust too.</p>
<p>All of that means these are happy times. Important feature in Ensemble being specified and written, very exciting tools, home grown software being useful..</p>
<p>Awesomeness.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.labix.org/2011/08/05/ensemble-go-and-mongodb-at-canonical/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Comparing package versions in PostgreSQL</title>
		<link>http://blog.labix.org/2006/07/30/comparing-package-versions-in-postgresql</link>
		<comments>http://blog.labix.org/2006/07/30/comparing-package-versions-in-postgresql#comments</comments>
		<pubDate>Mon, 31 Jul 2006 00:46:04 +0000</pubDate>
		<dc:creator>Gustavo Niemeyer</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.labix.org/2006/07/30/comparing-package-versions-in-postgresql/</guid>
		<description><![CDATA[This weekend I&#8217;ve played a bit with PostgreSQL extensions written in C. A while ago I wrote a Python C extension for Smart to compare Debian package versions. Now I was trying to do something similar inside PostgreSQL, and thus &#8230; <a href="http://blog.labix.org/2006/07/30/comparing-package-versions-in-postgresql">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This weekend I&#8217;ve played a bit with <a href="http://www.postgresql.org/docs/8.1/interactive/extend.html">PostgreSQL extensions</a> written in C.</p>
<p>A while ago I wrote a Python C extension for <a href="http://labix.org/smart">Smart</a> to compare <a href="http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version">Debian package versions</a>. Now I was trying to do something similar inside PostgreSQL, and thus ported the original Python C extension code to a PostgreSQL C extension. It enables queries like the following:</p>
<pre>
# SELECT 'Matched' WHERE deb_version_match('1.2', '<=', '2.0');
  ?column?
----------
 Matched
</pre>
<p>The implementation of the PostgreSQL C extension was quite straightforward, but I'm a bit disappointed by the performance of <a href="http://www.postgresql.org/docs/8.1/interactive/plpgsql.html">PL/PGSQL</a>.</p>
<p>I've made tests using two environments. One of them is a <a href="http://www.postgresql.org/docs/8.1/interactive/plpython.html">PL/Python</a> function executed as a <a href="http://www.postgresql.org/docs/8.1/interactive/triggers.html">trigger</a>, which calls the original Python C extension and executes SQL back in PostgreSQL using the <a href="http://www.postgresql.org/docs/8.1/interactive/plpython-database.html">plpy</a> module. The other is a  PL/PGSQL function which uses the implemented PostgreSQL C extension directly.</p>
<p>Considering that the function logic consisted of one loop over a SELECT statement, a few tests, and an INSERT statement, I was expecting that the overhead introduced by going back and forth between the PostgreSQL state and the Python interpreter state would be a lot more noticeable when compared with PL/PGSQL executing an internal PostgreSQL function. Tests have shown about 10% of improvement roughly, when doing a similar logic over about 5000 items.</p>
<p>I'm not yet sure if the speed improvement pays off the limited debugging feedback provided by the PL/PGSQL interpreter on errors.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.labix.org/2006/07/30/comparing-package-versions-in-postgresql/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

