<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Planet PostgreSQL</title><link>http://planet.postgresql.org</link><description>Planet PostgreSQL</description><lastBuildDate>Wed, 16 May 2012 19:46:22 GMT</lastBuildDate><generator>Planet PostgreSQL</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Bruce Momjian: Template1 Me!</title><link>http://momjian.us/main/blogs/pgblog/2012.html#May_16_2012</link><description>&lt;p&gt;You might have heard of the &lt;em&gt;template1&lt;/em&gt; database before, or seen it in the output of &lt;em&gt;pg_dumpall&lt;/em&gt;:
&lt;/p&gt;
&lt;p&gt;&lt;blockquote&gt;
&lt;/p&gt;&lt;pre class="quote_explicit"&gt;
REVOKE ALL ON DATABASE &lt;strong&gt;template1&lt;/strong&gt; FROM PUBLIC;
&amp;hellip;
&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://momjian.us/main/blogs/pgblog/2012.html#May_16_2012"&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</description><guid isPermaLink="false">http://momjian.us/main/blogs/pgblog/2012.html#May_16_2012</guid><pubDate>Wed, 16 May 2012 18:30:01 GMT</pubDate></item><item><title>Jeff Frost: Slony Upstart Script for Ubuntu 10.04 LTS</title><link>http://frosty-postgres.blogspot.com/2012/05/slony-upstart-script-for-ubuntu-1004.html</link><description>&amp;nbsp;Since Ubuntu is moving towards using upstart instead of SysV init scripts, I thought I'd write a quick upstart script for starting slony compiled and installed in /usr/local/slony.&amp;nbsp; Upstart 1.4+ supports setuid, but the version of upstart included with Ubuntu 10.04LTS is only 0.6.5 and even on Ubuntu 11.10, it's only 1.3, so instead I use start-stop-daemon's --chuid switch.&amp;nbsp; The script should be installed as /etc/init/slony.conf. Here's the script:&lt;br /&gt;&lt;br /&gt;---cut here---&lt;br /&gt;&lt;span&gt;# slony - slon daemon&lt;/span&gt;&lt;br /&gt;&lt;span&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span&gt;# slon is the slony replication daemon&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;description&amp;nbsp;&amp;nbsp;&amp;nbsp; "slony slon daemon"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;start on net-device-up&lt;/span&gt;&lt;br /&gt;&lt;span&gt;stop on runlevel [06]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;# can't use setuid until upstart 1.4&lt;/span&gt;&lt;br /&gt;&lt;span&gt;#setuid slony&lt;/span&gt;&lt;br /&gt;&lt;span&gt;# which is why we use start-stop-daemon with the --chuid switch&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;respawn&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;script&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec start-stop-daemon --start --chuid slony --exec /usr/local/slony/bin/slon -- -f /etc/slon.conf &amp;gt;&amp;gt; /var/log/slony/slony.log 2&amp;gt;&amp;amp;1&lt;/span&gt;&lt;br /&gt;&lt;span&gt;end script&lt;/span&gt;&lt;br /&gt;---cut here---&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This will have the slon daemon run as the slony user and log to /var/log/slony/slony.log.&amp;nbsp; You'll also need a valid slony config file in /etc/slon.conf. &lt;br /&gt;&lt;br /&gt;You can also find the script in the pgexperts upstart-scripts git repo:&lt;br /&gt;https://github.com/pgexperts/upstart-scripts&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2239123977960506445-3012019596890579363?l=frosty-postgres.blogspot.com" alt="" /&gt;&lt;/div&gt;</description><guid isPermaLink="true">tag:blogger.com,1999:blog-2239123977960506445.post-3012019596890579363</guid><pubDate>Tue, 15 May 2012 21:48:40 GMT</pubDate></item><item><title>Peter Eisentraut: My (anti-)take on database schema version management</title><link>http://petereisentraut.blogspot.com/2012/05/my-anti-take-on-database-schema-version.html</link><description>&lt;p&gt;There were a number of posts recently about managing schema versions and schema deployment in PostgreSQL.  I have analyzed these with great interest, but I have concluded that they are all more or less significantly flawed.  (Of course, most of these solutions do in fact work for someone, but they are not general enough to become canonical go-to solutions for this problem class, in my opinion.)  I have developed a list of elimination criteria by which I can evaluate future developments in this area.  So here are some of the things that I don't want in my schema version management system:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p&gt;Using schemas for distinguishing multiple versions (like &lt;a href="http://feedproxy.google.com/~r/blogspot/EzOjx/~3/HrUj6PXPD-c/schema-based-versioning-and-deployment.html"&gt;this&lt;/a&gt;, but that's actually more about API versioning).  That simply won't work for deploying objects that are not in schemas, such as casts, languages, extensions, and, well, schemas.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Using extensions (like &lt;a href="http://philsorber.blogspot.com/2012/01/deploy-schemata-like-boss.html"&gt;this&lt;/a&gt;). Well, this could work.  But extensions by themselves do nothing about the core problem.  They are just an SQL wrapper interface around upgrade scripts.  You still need to write the upgrade scripts, order them, test them, package them.  The extension mechanism might replace the, say, shell script that would otherwise run the upgrade files in a suitable order.  Another issue is that extensions require access to the server file system. Changing this is being &lt;a href="https://commitfest.postgresql.org/action/patch_view?id=746"&gt;discussed&lt;/a&gt;as "inline extensions", but there is no consensus.  This is a smaller problem, but it needs to be thought about.  Also, I do need to support PostgreSQL 9.0 and earlier for little while more.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Requiring naming each change (patch names, like &lt;a href="http://www.depesz.com/2010/08/22/versioning/"&gt;this&lt;/a&gt;).  Naming things is hard.  Numbering things is easy.  And how many good names are you going to still be able to come up with after 100 or so changes?&lt;/p&gt;  &lt;p&gt;Take a lesson from file version control systems: versions are numbers or, if it must be, hashes or the like (UUIDs have been suggested).&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Using a version control tool for tracking upgrade paths (like &lt;a href="http://justatheory.com/computers/databases/sqitch-draft.html"&gt;this&lt;/a&gt;). Sqitch, unlike the initial draft of this concept, doesn't actually require a version control tool for deployment, which wouldn't have worked for me, because what we ship is a tarball or a deb/rpm-type package.  But it still requires you to maintain some kind of sanity in your version control history so that the tool can make sense out of it.  That sounds fragile and inconvenient.  The other choice appears to be writing the plan files manually without any VCS involvement, but then this loses much of the apparent appeal of this tool, and it's really no better than the "naming each change" approach mentioned above.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Taking snapshots or the like of a production or staging or central development system.  Production systems and staging systems should be off limits for this sort of thing.  Central development systems don't exist, because with distributed version control, every developer has their own setups, branches, deployments, and world views.&lt;/p&gt; &lt;p&gt;You could set it up so that every developer gets their own test database, sets up the schema there, takes a dump, and checks that in.  There are going to be problems with that, including that dumps produced by &lt;code&gt;pg_dump&lt;/code&gt; are ugly and optimized for restoring, not for developing with, and they don't have a deterministic output order.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Storing the database source code in a different place or in a different manner than the rest of the source code.  This includes using a version control system like mentioned above (meaning storing part of the information in the version control meta information rather than in the files that are checked into the version control system in the normal way), using a separate repository like Post Facto, or using something like the mentioned staging server.&lt;/p&gt; &lt;p&gt;The source is the source, and it must be possible to check out, edit, build, test, and deploy everything in a uniform and customary manner.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Allowing lattice-like dependencies between change sets (like most examples cited above).  This sounds great on paper, especially if you want to support distributed development in branches.  But then you can have conflicts, for example where two upgrades add a column to the same table.  Depending on the upgrade path, you end up with different results.  As your change graph grows, you will have an exploding number of possible upgrade paths that will need to be tested.&lt;/p&gt; &lt;p&gt;There needs to be an unambiguous, canonical state of the database schema for a given source checkout.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Requiring running through all the upgrade scripts for a fresh deployment (like &lt;a href="http://www.depesz.com/2010/08/22/versioning/"&gt;this&lt;/a&gt;).  There are two problems with this.  First, it's probably going to be very slow.  Fresh deployments need to be reasonably fast, because they will be needed for automated tests, including unit tests, where you don't want to wait for minutes to set up the basic schema. Second, it's inefficient.  Over time, you might drop columns, add new columns, delete rows, migrate them to different tables, etc. If you run through all those upgrade scripts, then a supposedly fresh database will already contain a bunch of rubble, dropped attributes, dead rows, and the like.&lt;/p&gt; &lt;p&gt;Therefore, the current version needs to be deployable from a script that will not end up replaying history.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Using metalanguages or abstraction layers (like Pyrseas or Liquibase or any of the metaformats included in various web frameworks).  It'd probably a good idea to check some of these out for simple applications.  But my concern is whether using an abstraction layer would prevent me from using certain features. For example, look at the &lt;a href="http://pyrseas.wordpress.com/feature-matrix/"&gt;Pyrseas feature matrix&lt;/a&gt;. It's pretty impressive.  But it doesn't support extensions, roles, or grants.  So (going by that list), I can't use it.  (It's being &lt;a href="http://pyrseas.wordpress.com/2012/04/10/pyrseas-postgresql-features-feedback-requested/"&gt;worked on&lt;/a&gt;.) And in a previous version, when I looked at it for a previous project, it didn't support foreign-data functionality, so I couldn't use it then either.  And those are just the top-level things the author thought of.  Actually, the Pyrseas author has gone through some &lt;a href="http://pyrseas.wordpress.com/2012/03/05/more-database-tools/"&gt;effort&lt;/a&gt;to have almost complete coverage of PostgreSQL DDL features, so give this tool a try.  But it won't be for everyone.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So, I'm going to keep looking.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/5541296000399974369-4672623148988461810?l=petereisentraut.blogspot.com" alt="" /&gt;&lt;/div&gt;</description><guid isPermaLink="true">tag:blogger.com,1999:blog-5541296000399974369.post-4672623148988461810</guid><pubDate>Tue, 15 May 2012 20:46:51 GMT</pubDate></item><item><title>Magnus Hagander: Call for Papers - PostgreSQL Conference Europe 2012</title><link>http://blog.hagander.net/archives/205-Call-for-Papers-PostgreSQL-Conference-Europe-2012.html</link><description>&lt;p&gt;The &lt;a href="http://2012.pgconf.eu/callforpapers/"&gt;call for papers&lt;/a&gt; for PostgreSQL Conference Europe 2012 in Prague, the Czech Republic has now been posted. As usual, we are looking for talks on all topics related to PostgreSQL. At this point, we are looking for submissions for regular conference sessions - we will post a separate call for papers for lightning talks at a later time.&lt;/p&gt;

&lt;p&gt;We are also still looking for sponsors - please see &lt;a href="http://2012.pgconf.eu/becomesponsor/"&gt;our website&lt;/a&gt; for details about the sponsor benefits and the costs.&lt;/p&gt;

&lt;p&gt;Follow the news feed on our site, or our &lt;a href="https://twitter.com/pgconfeu"&gt;Twitter feed&lt;/a&gt;, for news updates!&lt;/p&gt;</description><guid isPermaLink="false">http://blog.hagander.net/archives/205-guid.html</guid><pubDate>Tue, 15 May 2012 19:49:00 GMT</pubDate></item><item><title>David Wheeler: Use of DBI in Sqitch</title><link>http://feedproxy.google.com/~r/justatheory/pgsum/~3/L2fS5_mX_GU/dbi-in-sqitch.html</link><description>&lt;p&gt;&lt;a href="http://sqitch.org/"&gt;Sqitch&lt;/a&gt; uses the native database client applications (&lt;a href="http://www.postgresql.org/docs/current/static/app-psql.html"&gt;&lt;code&gt;psql&lt;/code&gt;&lt;/a&gt;, &lt;a href="http://man.he.net/man1/sqlite3"&gt;&lt;code&gt;sqlite3&lt;/code&gt;&lt;/a&gt;, &lt;a href="http://dev.mysql.com/doc/refman/5.5/en/mysql.html"&gt;&lt;code&gt;mysql&lt;/code&gt;&lt;/a&gt;, etc.). So for tracking metadata about the state of deployments, I have been trying to stick to using them. I&amp;rsquo;m first targeting PostgreSQL, and as a result need to open a connection to &lt;code&gt;psql&lt;/code&gt;, start a transaction, and be able to read and write stuff to it as migrations go along. &lt;a href="http://stackoverflow.com/questions/10569805/what-is-the-preferred-cross-platform-ipc-perl-module"&gt;The IPC&lt;/a&gt; is a &lt;a href="http://www.perlmonks.org/?node_id=970244"&gt;huge PITA&lt;/a&gt;. Furthermore, getting things properly quoted is also pretty annoying &amp;mdash; and it will be worse for SQLite and MySQL, I expect (&lt;code&gt;psql&lt;/code&gt;&amp;rsquo;s &lt;code&gt;--set&lt;/code&gt; support is pretty slick).&lt;/p&gt;&lt;p&gt;&lt;a href="http://justatheory.com/computers/databases/dbi-in-sqitch.html"&gt;Read More »&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/justatheory/pgsum/~4/L2fS5_mX_GU" height="1" width="1" /&gt;</description><guid isPermaLink="true">tag:justatheory.com,2012:/computers/databases/dbi-in-sqitch</guid><pubDate>Tue, 15 May 2012 17:41:00 GMT</pubDate></item><item><title>Martin Pitt: Debian/Ubuntu Packages for PostgreSQL 9.2 Beta 1</title><link>http://www.piware.de/2012/05/packages-for-postgresql-9-2-beta-1-now-available/</link><description>&lt;p&gt;The first Beta of the upcoming PostgreSQL 9.2 was released yesterday (see &lt;a href="http://www.postgresql.org/about/news/1395/"&gt;announcement&lt;/a&gt;). Your humble maintainer has now created packages for you to test. Please give them a whirl, and report any problems/regressions that you may see to the PostgreSQL developers, so that we can have a rock solid 9.2 release.&lt;/p&gt;
&lt;p&gt;Remember, with the postgresql-common infrastructure you can use &lt;code&gt;pg_upgradecluster&lt;/code&gt; to create a 9.2 cluster from your existing 8.4/9.1 cluster and run them both in parallel without endangering your data.&lt;/p&gt;
&lt;p&gt;For Debian the package is currently waiting in the &lt;a href="http://ftp-master.debian.org/new.html"&gt;NEW queue&lt;/a&gt;, I expect them to go into experimental in a day or two. For Ubuntu 12.04 LTS you can get packages from my usual &lt;a href="https://launchpad.net/~pitti/+archive/postgresql"&gt;PostgreSQL backports PPA&lt;/a&gt;. Note that you need at least postgresql-common version 0.130, which is available in Debian unstable and the PPA now.&lt;/p&gt;
&lt;p&gt;I (or rather, the postgresql-common test suite) found &lt;strong&gt;one regression&lt;/strong&gt;: Upgrades do not keep the current value of sequences, but reset them to their default value. I &lt;a href="http://archives.postgresql.org/pgsql-bugs/2012-05/msg00084.php"&gt;reported this upstream&lt;/a&gt; and will provide updated packages as soon as this is fixed.&lt;/p&gt;</description><guid isPermaLink="true">http://www.piware.de/?p=629</guid><pubDate>Tue, 15 May 2012 12:33:08 GMT</pubDate></item><item><title>Hans-Juergen Schoenig: PostgreSQL resource consumption limitations</title><link>http://www.cybertec.at/en/postgresql-resource-consumption-limitations</link><description>&lt;p&gt;PostgreSQL offers a great deal of flexibility when it comes to resource&lt;br /&gt;
	allocation and efficient usage of hardware capacities. This allows fancy&lt;br /&gt;
	monitoring of what PostgreSQL does in production. Sometimes, however, better&lt;br /&gt;
	operating system integration is needed and helps to use hardware even more&lt;br /&gt;
	efficiently.&lt;br /&gt;
	&lt;br /&gt;
	On Linux one way to limit or allocate resources is to use the Linux kernel’s&lt;br /&gt;
	cgroup interface. cgroups and PostgreSQL are a perfect team for …&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;more efficient monitoring&lt;/li&gt;
	&lt;li&gt;restriciting use of resources&lt;/li&gt;
	&lt;li&gt;resource accounting.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;a name="heading-0"&gt;&lt;h3&gt;&lt;strong&gt;How do cgroups work?&lt;/strong&gt;&lt;/h3&gt;&lt;/a&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;On a Linux system cgroups (= control groups) are basically a way to group&lt;br /&gt;
	various operating system processes into groups. A group like that can then be&lt;br /&gt;
	assigned to a certain amount of RAM, a fraction of a CPU or to a certain number&lt;br /&gt;
	of I/O operations.&lt;/p&gt;
&lt;p&gt;Processes can be moved to a group manually or with the help of a daemon which&lt;br /&gt;
	moves processes to the right group automatically given some user-defined rules.&lt;br /&gt;
	It is easily possible to move all processes belonging to a user to some special&lt;br /&gt;
	cgroup and apply constraints to it. Following this approach you can move an&lt;br /&gt;
	entire PostgreSQL instance and all its processes to a certain cgroup.&lt;/p&gt;
&lt;p&gt;A simple config could look like that (/etc/cgconfig.conf):&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt;mount {
        cpu = /cgroup/main;
        cpuacct = /cgroup/main;
        memory = /cgroup/main;
        blkio = /cgroup/main;
}

group user_0004 {
    perm {
        admin {
            uid = root;
            gid = root;
        }
        task {
            uid = user_0004;
            gid = user_0004;
        }
    }
    memory {
        memory.limit_in_bytes = 256M;
    }
    cpu {
        cpu.shares = &amp;quot;75&amp;quot;;
    }
}

group user_0005 {
    perm {
        admin {
            uid = root;
            gid = root;
        }
        task {
            uid = user_0005;
            gid = user_0005;
        }
    }
    memory {
        memory.limit_in_bytes = 512M;
    }
    cpu {
        cpu.shares = &amp;quot;125&amp;quot;;
    }
}&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;We got two users which form separate groups. Each group will get certain&lt;br /&gt;
	fractions of the system’s CPU as well as a certain amount of memory. In other&lt;br /&gt;
	words: You can box a database instance nicely inside a group.&lt;/p&gt;
&lt;p&gt;In the next step you can nicely put processes into a group. This is best done&lt;br /&gt;
	using /etc/cgrules.conf:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt;user_0004        *       /user_0004
user_0005        *       /user_0005&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;In our case every user’s process is automatically moved to the right process on&lt;br /&gt;
	startup.&lt;/p&gt;
&lt;p&gt;More on cgroups will be available in further blog posts.&lt;/p&gt;</description><guid isPermaLink="false">http://www.cybertec.at/en/?p=1600</guid><pubDate>Mon, 14 May 2012 08:30:52 GMT</pubDate></item><item><title>Michael Paquier: Postgres-XC 1.0beta2 is released</title><link>http://michael.otacoo.com/postgresql-2/postgres-xc-1-0beta2-is-released/</link><description>&lt;div class="addthis_toolbox addthis_default_style"&gt;&lt;a class="addthis_button_google_plusone"&gt;&lt;/a&gt;&lt;a class="addthis_button_facebook_like"&gt;&lt;/a&gt;&lt;a class="addthis_button_tweet"&gt;&lt;/a&gt;&lt;/div&gt;Postgres-XC, write-scalable multi-master symmetric cluster based on PostgreSQL, version 1.0beta2 has been released. This beta version is based on PostgreSQL 9.1.3. All the patches in PostgreSQL 9.1 stable branch have been merged up to commit 1c0e678 (4th of May 2012). You can download the tarball directly from here. This tarball contains all the HTML and &lt;a href="http://michael.otacoo.com/postgresql-2/postgres-xc-1-0beta2-is-released/"&gt;[...]&lt;/a&gt;&lt;div class="addthis_toolbox addthis_default_style addthis_32x32_style"&gt;&lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt;&lt;a class="addthis_button_compact"&gt;&lt;/a&gt;&lt;/div&gt;</description><guid isPermaLink="false">http://michael.otacoo.com/?p=999</guid><pubDate>Sun, 13 May 2012 03:56:17 GMT</pubDate></item><item><title>Chris Travers: Thoughts on VoltDB and performance vs flexibility</title><link>http://ledgersmbdev.blogspot.com/2012/05/thoughts-on-voltdb-and-performance-vs.html</link><description>VoltDB is the latest project of Mike Stonebreaker (original founder of Postgres) aimed at very high performance OLTP.&amp;nbsp; It is fairly clearly a niche product however, and not really usable in the ERP space for reasons I will discuss below.&lt;br /&gt;&lt;br /&gt;Stonebreaker's own presentations (&lt;a href="http://www.youtube.com/watch?v=uhDM4fcI2aI"&gt;one example&lt;/a&gt;, at 11:25) suggest he is aware of this issue given his triangle framework.&lt;br /&gt;&lt;br /&gt;In the vertices of the triangle he places NoSQL, high performance OLTP (like VoltDB) and column-oriented databases, while in the second, as lower performance generalists, what he calls the legacy databases or elephants are in the middle.&amp;nbsp; The argument is that you can get a significant performance boost by specializing your systems beyond what you could when you have every system doing everything.&amp;nbsp; This is a fair argument to a point, but the implementation details show that it is true only in some areas.&lt;br /&gt;&lt;br /&gt;Stonebreaker's analysis of processing time (see above presentation, at 14:36) in traditional databases places virtually all processing time in four areas, namely buffer management, locking, thread locks/semaphores, and recovery tasks, and he suggests that in order to get high degrees of performance one must eliminate these tasks.&amp;nbsp; This requires, however, rethinking how we address concurrency (the locking issues) and durability (recovery and disk-based storage).&amp;nbsp; The VoltDB approach is to get rid of concurrency entirely and see durability as a network, rather than a system, property.&amp;nbsp; Concurrency elimination accepted because the db is fast enough that queries can be run one at a time, and intraquery parallelism can be used instead of interquery parallelism.&amp;nbsp; However, this imposes significant limitations on the database because it means that every transaction is limited to a single query.&amp;nbsp; You can't do round-tripping in your transactions because this would impose locking requirements on the database.&lt;br /&gt;&lt;br /&gt;This approach works very well for certain kinds of processing, such as consuming rapid data feeds and then feeding that information into a data warehouse at specified intervals.,&amp;nbsp; However one thing that is generally missing from the discussion is that the more complex the application, the more general the database solution needs to be.&amp;nbsp; One solution might be to separate data entry from reporting and use multiple tools, but who wants to pull their trial balance from a different system than they enter invoices on?&amp;nbsp; Since ERP systems usually tightly integrate decision support and OLTP, there isn't really room here to use specialized databases like VoltDB.&lt;br /&gt;&lt;br /&gt;As the database market has expanded, it has created niches for products like VoltDB.&amp;nbsp; These niches may indeed grow with time.&amp;nbsp; However, I think it is incorrect to treat generalists as legacy, outdated approaches.&lt;br /&gt;&lt;br /&gt;In essence VoltDB typifies what I call a specialism paradox, namely that  to perform well in a specialist niche one must give up generalist  solutions.&amp;nbsp; It is true that sometimes things improve and supplant older  systems but at least as often they only do when the systems are not  vastly more complex than the ones they are replacing.&amp;nbsp; For example,  Stonebreaker's comparison of high performance OLTP to the shift from  cable-operated digging excavation equipment to&amp;nbsp; hydrolics misses the  fact that hydrolic systems are not that much more complex than cables  and such.&amp;nbsp; There is some additional complexity, but it isn't a huge gap.&amp;nbsp;  A better comparison might be comparing semi trucks to race cars and  locomotives.&amp;nbsp; These are all highly engineered systems, but the basic  design considerations are very different, and specialization comes at  the cost of flexibility.&amp;nbsp; You will never see race cars hauling  twenty-foot containers of furniture cross-country, and you will never  see travelling along our nation's highways to reach out-of-the-way  towns.&amp;nbsp; The semi however will never pull the loads that the locomotive  can, and will never win the Indie 500......&amp;nbsp;&amp;nbsp; The semi truck, however, can go fast enough, and pull the loads it needs to pull.....&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/3346090548501966296-4913186920873803571?l=ledgersmbdev.blogspot.com" alt="" /&gt;&lt;/div&gt;</description><guid isPermaLink="false">tag:blogger.com,1999:blog-3346090548501966296.post-4913186920873803571</guid><pubDate>Sun, 13 May 2012 02:27:30 GMT</pubDate></item><item><title>Andrew Dunstan: Upgradable JSON</title><link>http://people.planetpostgresql.org/andrew/index.php?/archives/272-Upgradable-JSON.html</link><description>If you're using my &lt;a href="http://bitbucket.org/adunstan/json_91"&gt;backport of the 9.2 JSON feature&lt;/a&gt; in your 9.1 Postgres, you have a problem if you want to use pg_upgrade when moving to release 9.2: the type has the same name and behaviour in 9.1 as in 9.2, but the OIDs are different and so the upgrade will fail. If you use pg_dump/pg_restore, you should just be able to exclude the restoration of the extension and everything will "just work".&lt;br /&gt;
&lt;br /&gt;
But after a lot of trial and error I have come up with a different way to do things. In this scenario we don't install as an extension, and instead we borrow a bit of magic from pg_upgrade to make sure that the JSON type and its array type have the same OIDs as they will have in PostgreSQL 9.2. We also need to fool pg_upgrade when it runs, as it goes looking for a loadable module called json.so,  and of course in 9.,2 there isn't one because JSON is built in. So we need to supply a dummy one. But, given that, this too "just works". &lt;br /&gt;
&lt;br /&gt;
There might be some wrinkles I haven't foreseen, but I have done this quite a few times now without mishap. This is checked in on a separate branch of the json_91 repo callled "binup"&lt;br /&gt;
&lt;br /&gt;
If you are going to use this backport, I also highly recommend using the backport of the fix for missing column names on row expressions. This requires patching Postgres, but it's worth doing anyway, even if you're not using JSON - notably it affects some uses of hstore as well. You can get this by pulling the port into a git repo set at REL9_1_STABLE by doing:&lt;blockquote&gt;&lt;pre&gt;git pull https&amp;#58;//bitbucket.org/adunstan/pgdevel.git rowexpr91&lt;/pre&gt;&lt;/blockquote&gt;Enjoy.</description><guid isPermaLink="false">http://people.planetpostgresql.org/andrew/index.php?/archives/272-guid.html</guid><pubDate>Sat, 12 May 2012 15:51:00 GMT</pubDate></item><item><title>Hitoshi Harada: PL/coffee Trial</title><link>http://umitanuki.hatenablog.com/entry/2012/05/11/025816</link><description>&lt;p&gt;We are getting to the final stage of the first stable release of PL/v8.  This should be a good release with a lot of improvement such like&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subtransaction support&lt;/li&gt;
&lt;li&gt;Better name space of built-in functions&lt;/li&gt;
&lt;li&gt;OO style cursor, prepared plan&lt;/li&gt;
&lt;li&gt;find_function&lt;/li&gt;
&lt;li&gt;Start-up procedure with GUC&lt;/li&gt;
&lt;li&gt;Separate context in user switch&lt;/li&gt;
&lt;li&gt;A series of bug fixes.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;And these days I'm getting increasing number of interests and feedback via email, &lt;a class="keyword" href="http://d.hatena.ne.jp/keyword/SNS"&gt;SNS&lt;/a&gt;, plv8 project page.  Upcoming PGCon will at least have two talks that may cover the usage of PL/v8.&lt;/p&gt;&lt;p&gt;In the mean time, there was a long standing feature request of PL/coffee, a procedural language in CoffeeScript, the dialect of &lt;a class="keyword" href="http://d.hatena.ne.jp/keyword/JavaScript"&gt;JavaScript&lt;/a&gt;.  CoffeeScript is only a source-source transformation, and the compiler is provided as a tiny &lt;a class="keyword" href="http://d.hatena.ne.jp/keyword/JavaScript"&gt;JavaScript&lt;/a&gt;, so I tried to let the compiler to transform plv8 source if the language is "plcoffee".&lt;/p&gt;

    &lt;pre class="code"&gt;=# CREATE OR REPLACE FUNCTION public.fibonacci(n integer)
 RETURNS integer LANGUAGE plcoffee IMMUTABLE STRICT
AS $function$
fibonacci = (x)-&amp;gt;
  return 0 if x == 0
  return 1 if x == 1
  return fibonacci(x-1) + fibonacci(x-2)
return fibonacci n
$function$;
CREATE FUNCTION

=# select fibonacci(10);
 fibonacci 
-----------
        55
(1 row)&lt;/pre&gt;
&lt;p&gt;As I noted above, this is only a source transformation, so the engine is still v8, and the runtime environment and other stuff are shared with plv8.  Of course it can reference plv8 function via find_function().  The plcoffee EXTENSION is separate and by default it's off.  If you are interested in it, clone the latest source and say&lt;/p&gt;

    &lt;pre class="code"&gt;make ENABLE_COFFEE=1 install&lt;/pre&gt;
&lt;p&gt;It works and it attracts more interest from the people around some area.  However, it seems it is a little controversial to use CoffeeScript (of course not in the database usage context, but in the web browser and server context) that the source transformation is quite difficult to debug since the problems like run time error emitted by the JS engine is far from the actual script source, which is so annoying.  And since I embed the compiler JS source file as a object file symbol, the size of plv8 shared object gets from around 200k byte to 600k byte.  Thus, for now I leave it as an "experimental" feature and want to see if it gets popular or not.&lt;/p&gt;</description><guid isPermaLink="true">http://umitanuki.hatenablog.com/id/12704538227038618385</guid><pubDate>Thu, 10 May 2012 17:58:16 GMT</pubDate></item><item><title>Bruce Momjian: Postgres 9.2 Draft Release Note Published</title><link>http://momjian.us/main/blogs/pgblog/2012.html#May_10_2012</link><description>&lt;p&gt;I have completed the Postgres 9.2 &lt;a class="major" href="http://www.postgresql.org/docs/devel/static/release-9-2.html"&gt;release notes&lt;/a&gt; I
&lt;a class="txt2html" href="http://momjian.us/main/blogs/pgblog/2012.html#May_3_2012"&gt;started&lt;/a&gt; seven days ago. Writing the release notes is always a taxing
experience.  I have to basically dedicate an entire week to the process of digesting 1100 commit messages to produce 3000 lines of SGML
text.  Once I am done though, it is rewarding to see the finished product.  It is like working on a painting all year, and spending a
frustrating week framing it and hanging it on the all &amp;mdash; once it is hung, you stand and admire it, and forget much of the sweat it took
to produce.  &lt;img src="http://momjian.us/main/img/blog/wink.png" /&gt;
&lt;/p&gt;
&lt;p&gt;Curious about how the 9.2 release item count compares to previous major releases?  Here are the results:
&lt;/p&gt;
&lt;table border="1" summary=""&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Release&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;Items&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;9.2&lt;/td&gt;&lt;td&gt;245&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;9.1&lt;/td&gt;&lt;td&gt;213&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;9.0&lt;/td&gt;&lt;td&gt;252&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8.4&lt;/td&gt;&lt;td&gt;330&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8.3&lt;/td&gt;&lt;td&gt;237&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8.2&lt;/td&gt;&lt;td&gt;230&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8.1&lt;/td&gt;&lt;td&gt;187&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8.0&lt;/td&gt;&lt;td&gt;238&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;7.4&lt;/td&gt;&lt;td&gt;280&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;&lt;a href="http://momjian.us/main/blogs/pgblog/2012.html#May_10_2012"&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</description><guid isPermaLink="false">http://momjian.us/main/blogs/pgblog/2012.html#May_10_2012</guid><pubDate>Thu, 10 May 2012 04:45:01 GMT</pubDate></item><item><title>Andrew Dunstan: Deploying file_text_array Foreign Data wrapper</title><link>http://people.planetpostgresql.org/andrew/index.php?/archives/271-Deploying-file_text_array-Foreign-Data-wrapper.html</link><description>Today, a moment planned  18 months ago arrived when I was able to deploy the &lt;a href="https://github.com/adunstan/file_text_array_fdw"&gt;file_text_array&lt;/a&gt; foreign data wrapper for the client for whom it was originally designed. It's taken this long for the client to move to the 9.1 release, and they suddenly emailed me today saying they needed the old ragged CSV feature I'd previously provided them. I explained to them that this was meant to replace it, and it took me all of about 5 minutes to deploy, and a further hour or two to adjust and test the code in the ETL tool that is meant to use it. It's all working flawlessly, I'm happy to say.</description><guid isPermaLink="false">http://people.planetpostgresql.org/andrew/index.php?/archives/271-guid.html</guid><pubDate>Thu, 10 May 2012 03:45:43 GMT</pubDate></item><item><title>Leo Hsu and Regina Obe: File FDW Family: Part 2 file_textarray_fdw Foreign Data Wrapper</title><link>http://www.postgresonline.com/journal/archives/251-File-FDW-Family-Part-2-file_textarray_fdw-Foreign-Data-Wrapper.html</link><description>&lt;p&gt;Last time we demonstrated &lt;a href="http://www.postgresonline.com/journal/archives/250-File-FDW-Family-Part-1-file_fdw.html" target="_blank"&gt;how to query delimited text files&lt;/a&gt; using the &lt;a href="http://www.postgresql.org/docs/current/interactive/file-fdw.html"&gt;&lt;em&gt;fdw_file&lt;/em&gt;&lt;/a&gt; that comes pacakged with PostgreSQL 9.1+, this time we'll continue our journey into Flat file querying Foreign Data Wrapper using an experimental foreign data wrapper designed for also querying delimited data, but outputting it as a single column text array table. 
This one is called &lt;em&gt;file_textarray_fdw&lt;/em&gt; and developed by Andrew Dunstan.  It's useful if you are dealing with for example jagged files, where not all columns are not properly filled in for each record or there are just a ton of columns you don't want to bother itemizing before you bring in. The benefit is you can still query and decide how you want to break it apart. You can grab the source code from &lt;a href="https://github.com/adunstan/file_text_array_fdw" target="_blank"&gt;file_text_array_fdw source code&lt;/a&gt;.  If you are on windows, we have compiled binaries in our Bag o' FDWs for both &lt;a href="http://www.postgresonline.com/downloads/fdw_win32_91_bin.zip"&gt;PostgreSQL 9.1 32-bit FDW  for Windows bag&lt;/a&gt; and &lt;a href="http://www.postgresonline.com/downloads/fdw_win64_91_bin.zip"&gt;PostgreSQL 9.1 64-bit FDW for Windows bag&lt;/a&gt; that should work fine with the EDB installed windows binaries. 
For other systems, the compile is fairly easy if you have the postgresql development libraries installed.&lt;/p&gt; &lt;br /&gt;&lt;a href="http://www.postgresonline.com/journal/archives/251-File-FDW-Family-Part-2-file_textarray_fdw-Foreign-Data-Wrapper.html#extended"&gt;Continue reading "File FDW Family: Part 2 file_textarray_fdw Foreign Data Wrapper"&lt;/a&gt;</description><guid isPermaLink="false">http://www.postgresonline.com/journal/archives/251-guid.html</guid><pubDate>Thu, 10 May 2012 03:44:00 GMT</pubDate></item><item><title>Michael Paquier: Rules in Postgres-XC</title><link>http://michael.otacoo.com/postgresql-2/rules-in-postgres-xc/</link><description>&lt;div class="addthis_toolbox addthis_default_style"&gt;&lt;a class="addthis_button_google_plusone"&gt;&lt;/a&gt;&lt;a class="addthis_button_facebook_like"&gt;&lt;/a&gt;&lt;a class="addthis_button_tweet"&gt;&lt;/a&gt;&lt;/div&gt;One of the features that has been really improved the last couple of weeks is the stabilization of remote query planning for DML for Postgres-XC standard planner. And this has consequences on rules, because a rule is fired on Coordinators by design, and you need to provide a global way to plan queries correctly with &lt;a href="http://michael.otacoo.com/postgresql-2/rules-in-postgres-xc/"&gt;[...]&lt;/a&gt;&lt;div class="addthis_toolbox addthis_default_style addthis_32x32_style"&gt;&lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt;&lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt;&lt;a class="addthis_button_compact"&gt;&lt;/a&gt;&lt;/div&gt;</description><guid isPermaLink="false">http://michael.otacoo.com/?p=968</guid><pubDate>Wed, 09 May 2012 00:16:48 GMT</pubDate></item><item><title>Greg Sabino Mullane: Monitoring many Postgres files at once with tail_n_mail</title><link>http://blog.endpoint.com/2012/05/tailnmail-postgres-monitoring.html</link><description>&lt;div class="separator"&gt;
&lt;a href="http://1.bp.blogspot.com/-HEr7HAQgjb4/T6fhv7tArsI/AAAAAAAAAQ0/UQl0WRAmCNw/s1600/pgelephant_groucho2.png"&gt;&lt;img border="0" height="258" width="250" src="http://1.bp.blogspot.com/-HEr7HAQgjb4/T6fhv7tArsI/AAAAAAAAAQ0/UQl0WRAmCNw/s320/pgelephant_groucho2.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;!--
span.d{color:gray;}
span.c{color:green;font-family:monospace;}
span.o{font-family:monospace;color:#0022cc;}
span.oo{font-family:monospace;font-weight:bolder;}
--&gt;

&lt;p&gt;&lt;em&gt;This post discusses version 1.25.0 of tail_n_mail, which can be downloaded at &lt;a href="http://bucardo.org/wiki/Tail_n_mail"&gt;http://bucardo.org/wiki/Tail_n_mail&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;One of our clients recently had one of their Postgres servers 
crash. In technical terms, it issued a 
&lt;a href="http://www.postgresql.org/docs/current/static/runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS"&gt;PANIC&lt;/a&gt; because it tried to commit a transaction that had already been committed. We 
are using &lt;strong&gt;tail_n_mail&lt;/strong&gt; for this client, and while we got notified 
six ways to Sunday about the server being down (from Nagios, 
tail_n_mail, and other systems), I was curious as to why the actual PANIC had 
not gotten picked up by tail_n_mail and mailed out to us.&lt;/p&gt;

&lt;p&gt;The tail_n_mail program at its simplest is a Perl script that 
greps through log files, finds items of interest, and mails them out. 
It does quite a bit more than that, of course, including normalizing 
SQL, figuring out which log files to scan, and analyzing the data 
on the fly. This particular client of ours consolidates all of their logs to some central 
logging boxes via rsyslog. For the host in question that issued the PANIC, we had two 
tail_n_mail config files that looked like this:&lt;/p&gt;

&lt;pre class="brush: config; toolbar: false"&gt;
## Config file for the tail_n_mail program
## This file is automatically updated
## Last updated: Fri Apr 27 18:00:01 2012
MAILSUBJECT: Groucho fatals: NUMBER

INHERIT: tail_n_mail.fatals.global.txt

FILE: /var/log/%Y/groucho/%m/%d/%H/pgsql-err.log
LASTFILE: /var/log/2012/groucho/04/27/18/pgsql-err.log
OFFSET: 10199
&lt;/pre&gt;

&lt;pre class="brush: config; toolbar: false"&gt;
## Config file for the tail_n_mail program
## This file is automatically updated
## Last updated: Fri Apr 27 18:00:01 2012
MAILSUBJECT: Groucho fatals: NUMBER

INHERIT: tail_n_mail.fatals.global.txt

FILE: /var/log/%Y/groucho/%m/%d/%H/pgsql-warning.log
LASTFILE: /var/log/2012/groucho/04/27/18/pgsql-warning.log
OFFSET: 7145

&lt;/pre&gt;

&lt;p&gt;The reason for two files was that rsyslog was splitting the 
incoming Postgres logs into multiple files. Which is normally a 
very handy thing, because the main file, &lt;strong&gt;pgsql-info.log&lt;/strong&gt;, 
is quite large, and it's nice to have the mundane things filtered 
out for us already. Because rsyslog also splits things based on the timestamp, 
we don't give it an exact file name, but use a POSIX template 
instead, e.g. &lt;span&gt;/var/log/apps/%Y/groucho/%m/%d/%H/pgsql-warning.log&lt;/span&gt;. 
By doing this, tail_n_mail knows where to find the latest file. 
It also uses the LASTFILE and OFFSET to know exactly where it stopped 
last time, and then walks through all files from LASTFILE until 
the current one.&lt;/p&gt;

&lt;p&gt;So why did we miss the PANIC? Because it was in a heretofore unseen 
and untracked log file known as &lt;strong&gt;pgsql-crit.log&lt;/strong&gt;. (Which goes 
to show how rarely Postgres crashes: this was the first time in well over 
700,000 log files generated that a PANIC had occurred!) At this point, the 
solution was to either create yet another set of config files for each host 
to watch for and parse any pgsql-crit.log files, or to 
give tail_n_mail some more brains and allow it to handle multiple 
FILE entries in a single config file. Obviously, I chose the latter.&lt;/p&gt;

&lt;p&gt;After some period of coding, testing, debugging, and caffeine consumption, 
a new tail_n_mail was ready. This one (version 1.25.0) allows multiple values of the FILE parameter 
inside of a single config. Thus, for the above, I was able to combine everything into a single 
tail_n_mail config file like so:&lt;/p&gt;

&lt;pre class="brush: config; toolbar: false"&gt;
MAILSUBJECT: Groucho fatals: NUMBER

INHERIT: tail_n_mail.fatals.global.txt

FILE: /var/log/%Y/groucho/%m/%d/%H/pgsql-warning.log
FILE: /var/log/%Y/groucho/%m/%d/%H/pgsql-err.log
FILE: /var/log/%Y/groucho/%m/%d/%H/pgsql-crit.log
&lt;/pre&gt;

&lt;p&gt;The INHERIT file is a way of keeping common config items in a 
single file: in this case, groucho and a bunch of other similar 
hosts all use it. It contains the rules on what tail_n_mail 
should care about, and looks similar to this:&lt;/p&gt;

&lt;pre class="brush: config; toolbar: false"&gt;
## Global behavior for all "fatals" configs
EMAIL: acme-alerts@endpoint.com
FROM: postgres@endpoint.com
FIND_LINE_NUMBER: 0
STATEMENT_SIZE: 3000
INCLUDE: FATAL:
INCLUDE: PANIC:
INCLUDE: ERROR:

## Client specific exceptions:
EXCLUDE: ERROR:  Anvils cannot be delivered via USPS
EXCLUDE: ERROR:  Jetpack fuel quantity missing
EXCLUDE: ERROR:  Iron Carrots and Giant Magnets must go to different addresses
EXCLUDE: ERROR:  Rocket Powered Rollerskates no longer available

## Postgres excceptions:
EXCLUDE: ERROR:  aggregates not allowed in WHERE clause
EXCLUDE: ERROR:  negative substring length not allowed
EXCLUDE: ERROR:  there is no escaped character
EXCLUDE: ERROR:  operator is not unique
EXCLUDE: ERROR:  cannot insert multiple commands into a prepared statement
EXCLUDE: ERROR:  value "\d+" is out of range for type integer
EXCLUDE: ERROR:  could not serialize access due to concurrent update
&lt;/pre&gt;

&lt;p&gt;Thus, we only have one file per host to worry about, in addition to a common 
shared file across all hosts. So now tail_n_mail can handle multiple files over a time 
dimension (by walking forward from LASTFILE to the present), as well as over a vertical 
dimension (by forcing together the files split by rsyslog). However, there is no reason we 
cannot handle multiple files over a horizontal dimension as well. In other words, 
putting multiple hosts into a single file. In this client's case, there were other 
hosts very similar to "groucho" that had files we wanted to monitor. Thus, the 
config file was changed to look like this:&lt;/p&gt;

&lt;pre class="brush: config; toolbar: false"&gt;
MAILSUBJECT: Acme fatals: NUMBER

INHERIT: tail_n_mail.fatals.global.txt

FILE: /var/log/%Y/groucho/%m/%d/%H/pgsql-warning.log
FILE: /var/log/%Y/groucho/%m/%d/%H/pgsql-err.log
FILE: /var/log/%Y/groucho/%m/%d/%H/pgsql-crit.log

FILE: /var/log/%Y/dawson/%m/%d/%H/pgsql-warning.log
FILE: /var/log/%Y/dawson/%m/%d/%H/pgsql-err.log
FILE: /var/log/%Y/dawson/%m/%d/%H/pgsql-crit.log

FILE: /var/log/%Y/cosby/%m/%d/%H/pgsql-warning.log
FILE: /var/log/%Y/cosby/%m/%d/%H/pgsql-err.log
FILE: /var/log/%Y/cosby/%m/%d/%H/pgsql-crit.log
&lt;/pre&gt;

&lt;p&gt;We've just whittled nine config files down to a single one. Of course, the config file cannot stay like that, as the LASTFILE and OFFSET entries need to be applied to specific files. Thus, when tail_n_mail 
does its first rewrite of the config file, it will assign numbers to 
each FILE, and the file will then look something like this:&lt;/p&gt;

&lt;pre class="brush: config; toolbar: false"&gt;
FILE1: /var/log/%Y/groucho/%m/%d/%H/pgsql-warning.log
LASTFILE1: /var/log/2012/groucho/04/27/18/pgsql-warning.log
OFFSET1: 100


FILE2: /var/log/%Y/groucho/%m/%d/%H/pgsql-err.log
LASTFILE2: /var/log/2012/groucho/04/27/18/pgsql-err.log
OFFSET2: 2531

FILE3: /var/log/%Y/groucho/%m/%d/%H/pgsql-crit.log

FILE4: /var/log/%Y/dawson/%m/%d/%H/pgsql-warning.log
LASTFILE4: /var/log/2012/dawson/04/27/18/pgsql-warning.log
OFFSET4: 42

# etc.
&lt;/pre&gt;

&lt;p&gt;By using this technique, we were able to reduce a slew of 
config files (the actual number was around 60), and their crontab entries, 
into a single config file and a single cron call. We also have a daily "error" report 
that mails a summary of all ERROR/FATAL calls in the last 24 hours. 
These were consolidated into a single email, rather than the half 
dozen that appeared before.&lt;/p&gt;

&lt;p&gt;While tail_n_mail has a lot of built-in intelligence to handle 
Postgres logs, it is ultimately regex-based and can be used on 
any files which you want to track and receive alerts when certain 
items appear inside of them, so feel free to use it for more than just Postgres!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/7997313029981170997-5981878122327616540?l=blog.endpoint.com" alt="" /&gt;&lt;/div&gt;</description><guid isPermaLink="true">tag:blogger.com,1999:blog-7997313029981170997.post-5981878122327616540</guid><pubDate>Tue, 08 May 2012 17:22:54 GMT</pubDate></item><item><title>Andrew Dunstan: Mixing compilers</title><link>http://people.planetpostgresql.org/andrew/index.php?/archives/270-Mixing-compilers.html</link><description>Regina has been reporting problems with running my &lt;a href="https://github.com/adunstan/file_fixed_length_record_fdw"&gt;Fixed Length Record  Foreign Data Wrapper&lt;/a&gt; on Windows. I tried it yesterday on my MinGW 64 bit setup and it worked just fine. It turns out she's been trying to run a mingw compiled FDW DLL with a VC++ built Postgres.  I'm not sure that we actually expect mixing compilers like that to work. In fact, I'm not sure how to build extension modules for VC++ builds at all. My approach would probably be to build them in tree, possibly modifying the build scripts slightly, but I haven't tried. It would be nice if this were documented better.</description><guid isPermaLink="false">http://people.planetpostgresql.org/andrew/index.php?/archives/270-guid.html</guid><pubDate>Tue, 08 May 2012 15:14:00 GMT</pubDate></item><item><title>Josh Berkus: Amazonstravaganza tommorrow, on UStream</title><link>http://www.databasesoup.com/2012/05/amazonstravaganza-tommorrow-on-ustream.html</link><description>Tommorrow we're going to have two back-to-back &lt;a href="http://www.meetup.com/postgresql-1/"&gt;SFPUG&lt;/a&gt; presentations about &lt;a href="http://www.meetup.com/postgresql-1/events/53504532/"&gt;running PostgreSQL on AWS&lt;/a&gt;: Scalr presenting their stuff, and "Amazon With Reduced Tears" by Christophe Pettus.&amp;nbsp; The event is sold out at 100 RSVPs, though, so I suggest you watch it on video!&lt;br /&gt;&lt;br /&gt;Barring severe technical difficulties, it will be presented live on &lt;a href="http://www.ustream.tv/channel/sfpug"&gt;SFPUG Ustream&lt;/a&gt;.&amp;nbsp;&amp;nbsp; Festivities should start around 7:15 PM PDT.&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/7476449567742726187-2755420610932112023?l=www.databasesoup.com" alt="" /&gt;&lt;/div&gt;</description><guid isPermaLink="true">tag:blogger.com,1999:blog-7476449567742726187.post-2755420610932112023</guid><pubDate>Tue, 08 May 2012 05:37:53 GMT</pubDate></item><item><title>John DeSoi: PostgreSQL support in Ace editor</title><link>http://pgedit.com/node/402</link><description>&lt;div class="field field-name-body field-type-text-with-summary field-label-hidden"&gt;&lt;div class="field-items"&gt;&lt;div class="field-item even"&gt;&lt;p&gt;&lt;a href="http://ajaxorg.github.com/ace/"&gt;Ace is a standalone code editor&lt;/a&gt; written in JavaScript. It now supports PostgreSQL specific syntax coloring, including support for pl/pgsql, pl/perl, and pl/python.&lt;/p&gt;
&lt;p&gt;To try the &lt;a href="http://ajaxorg.github.com/ace/build/kitchen-sink.html"&gt;live demo&lt;/a&gt;, just select "pgSQL" from the Document menu.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><guid isPermaLink="false">http://pgedit.com/402 at http://pgedit.com</guid><pubDate>Tue, 08 May 2012 01:55:00 GMT</pubDate></item><item><title>Hubert 'depesz' Lubaczewski: OmniPITR 0.7.0</title><link>http://www.depesz.com/2012/05/07/omnipitr-0-7-0/</link><description>Just released new version of OmniPITR. This version has one important new feature: when you&amp;#8217;re calling omnipitr-backup-slave, it will make backups only of required xlog files, and not, as previously, of all in walarchive directory. This is important, especially in case you have multiple slaves, or you keep shared long-term walarchive. Previously &amp;#8211; backups would [...]</description><guid isPermaLink="false">http://www.depesz.com/?p=2451</guid><pubDate>Mon, 07 May 2012 20:34:27 GMT</pubDate></item><item><title>Bruce Momjian: Postgres Drinking Game</title><link>http://momjian.us/main/blogs/pgblog/2012.html#May_7_2012</link><description>&lt;p&gt;My children have traveled to many conferences with me, and have heard many webcasts and training calls at home.  I guess, after hearing
about Postgres so often, they pick up certain phases of interest, and the big one for them is "shared buffers".  Anytime someone uses
those words, they start howling and make up some funny sentence using the words. 
&lt;/p&gt;
&lt;p&gt;There are a variety of beer drinking &lt;a class="txt2html" href="http://en.wikipedia.org/wiki/Drinking_game#Film"&gt;games&lt;/a&gt; that trigger drinking when a
&lt;a class="txt2html" href="http://www.realbeer.com/fun/games/movie.php"&gt;word&lt;/a&gt; is said &amp;mdash; perhaps "shared buffers" is enough on its own to make a drinking game. 
&lt;img src="http://momjian.us/main/img/blog/wink.png" /&gt; 
&lt;/p&gt;</description><guid isPermaLink="false">http://momjian.us/main/blogs/pgblog/2012.html#May_7_2012</guid><pubDate>Mon, 07 May 2012 13:15:01 GMT</pubDate></item><item><title>Josh Berkus: Random Page Cost Revisited</title><link>http://www.databasesoup.com/2012/05/random-page-cost-revisited.html</link><description>Because the planner has limited information about the host system PostgreSQL is running on, we offer several planner configuration variables, which can be set either dynamically or in the postgresql.conf file.&amp;nbsp; One of these, which has been a source of much contention in the past, is &lt;a href="http://www.postgresql.org/docs/current/static/runtime-config-query.html#RUNTIME-CONFIG-QUERY-CONSTANTS"&gt;Random Page Cost&lt;/a&gt; (or random_page_cost, hereafter RPC).&amp;nbsp; For the last couple of years RPC was not a variable you needed to worry about, but now, thanks to advances in storage technology, it's become one of the essential parameters again.&lt;br /&gt;&lt;br /&gt;Random Page Cost is meant to represent the coefficient between the cost of looking up one row (out of many) via sequential reads, vs. the cost of looking up a single row individually using random access (disk seeks).&amp;nbsp; This factor strongly influences the planner's decisions to use indexes vs. table scan, and composite vs. simple indexes, in executing queries.&lt;br /&gt;&lt;br /&gt;For many generations of spinning hard drives, this ratio remained about the same, around 4.0.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;Things have changed recently though.&amp;nbsp; In fact, there are five now-common types of storage where you want to change RPC in order to match a different scan/seek ratio for different hardware.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1. High-End NAS/SAN:&lt;/b&gt; when working well, your large storage box combines a large volatile cache with many many disks, improving the number of concurrent seeks you can do.&amp;nbsp; However, if storage is not direct-attach, you usually have limited throughput.&amp;nbsp; This means that a random_page_cost of 2.5 or 3.0 is more appropriate.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Amazon EBS and Heroku:&lt;/b&gt;&amp;nbsp; EBS, especially when "RAIDed", is an extreme example of the NAS/SAN case.&amp;nbsp; Seeks are fast with virtually unlimited concurrency, while storage bandwitdh is erratic and slow, limiting full table scans.&amp;nbsp; As such, we often use a random_page_cost of 2.0.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. Bad SANs:&lt;/b&gt; the advent of iSCSI seems to have inspired a large variety of very poor-performing inexpensive storage units, such as the lower-end Dell Equallogics and various SATA-based Promise units.&amp;nbsp; These boxes are cheaper for a reason, folks!&amp;nbsp; Anyway, their quirks often give these boxes unique performance characteristics which strongly affect database access and prompt you to modify planner parameters.&amp;nbsp; For example, we discovered through testing that one Promise box had decent throughput, but seek rates slower than a single drive due to a combination of architecture and driver issues.&amp;nbsp; As such, we set RPC to 6.0.&amp;nbsp; You'll have to trust the results of bonnie++ and fio in order to figure out where you should set things, though; each inferior unit is inferior in a different way.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4. SSDs:&lt;/b&gt; in general, SSDs have not lived up to their early hype for performance; random writes and sequential scans on most SSDs are only incrementally better than on HDDs.&amp;nbsp; One area where SSDs shine, though, is random page access; a good array of SSDs can make even large index scans faster than sequential scans.&amp;nbsp; Therefore, use a random_page_cost of 2.0 to 2.5.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;5. NvRAM (or NAND)&lt;/b&gt;: durable memory, such as FusionIO and Virident drives, do deliver on most of the performance promises originally made about SSDs.&amp;nbsp; Everything is faster, sometimes orders of magnitude faster, than HDDs, most of all random access.&amp;nbsp; While the concept of NvRAM might make you inclined to set RPC to 1, forcing almost 100% index access, that's going a little far because PostgreSQL still has a disk page structure.&amp;nbsp; Therefore, I suggest 1.5.&lt;br /&gt;&lt;br /&gt;Note that two other variables, effective_cache_size and  effective_io_concurrency also affect seek/scan behavior.&amp;nbsp; Possibly I  will blog about them at a different time.&amp;nbsp; Further, I have only been able to test with relatively few models and configurations of the above types of storage, so test, monitor and check your results before committing to a long-term configuration change.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/7476449567742726187-6500162815335716037?l=www.databasesoup.com" alt="" /&gt;&lt;/div&gt;</description><guid isPermaLink="true">tag:blogger.com,1999:blog-7476449567742726187.post-6500162815335716037</guid><pubDate>Mon, 07 May 2012 05:16:35 GMT</pubDate></item><item><title>Bruce Momjian: The Effectiveness of effective_cache_size</title><link>http://momjian.us/main/blogs/pgblog/2012.html#May_4_2012</link><description>&lt;p&gt;Having &lt;a class="txt2html" href="http://momjian.us/main/blogs/pgblog/2012.html#May_2_2012"&gt;reported&lt;/a&gt; the methods for finding the size of the kernel cache on
Linux, I wish to highlight the importance of the postgresql.conf setting
&lt;a class="txt2html" href="http://www.postgresql.org/docs/9.1/static/runtime-config-query.html#RUNTIME-CONFIG-QUERY-CONSTANTS"&gt;&lt;em&gt;effective_cache_size&lt;/em&gt;&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;Unlike other memory settings that control how memory is allocated, effective_cache_size tells the optimizer how much cache is present in
the kernel.  This is important for determining how expensive large index scans will be.  The optimizer knows the size of
&lt;a class="txt2html" href="http://www.postgresql.org/docs/9.1/static/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-MEMORY"&gt;shared_buffers&lt;/a&gt;, but not the
kernel cache size, which affects the probability of expensive disk access.
&lt;/p&gt;
&lt;p&gt;&lt;a href="http://momjian.us/main/blogs/pgblog/2012.html#May_4_2012"&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</description><guid isPermaLink="false">http://momjian.us/main/blogs/pgblog/2012.html#May_4_2012</guid><pubDate>Fri, 04 May 2012 12:30:01 GMT</pubDate></item><item><title>Josh Berkus: SELECT fire_proton_torpedoes();</title><link>http://www.databasesoup.com/2012/05/at-pgcon-this-year-you-will-have-chance.html</link><description>At &lt;a href="http://www.pgcon.org/2012/"&gt;pgCon&lt;/a&gt; this year you will have the chance to reduce your fellow attendees to their component elements, and win prizes for it!&lt;br /&gt;&lt;br /&gt;We will be having a &lt;a href="https://schemaverse.com/"&gt;Schemaverse&lt;/a&gt; tournament for the length of the conference.&amp;nbsp; Schemaverse is an amazing game which demonstrates that PostgreSQL isn't just a database, it's an entire development environment.&amp;nbsp; You build a fleet of starships, fight battles, take planets, trade, and conquer the galaxy ... all from the psql command line.&amp;nbsp; Write PL/pgSQL functions to command your armies!&lt;br /&gt;&lt;br /&gt;To make things even more interesting, if you can hack into the Postgres server, you can win the game. &lt;br /&gt;&lt;br /&gt;The Schemaverse tournament will begin Wednesday night and end shortly before the closing session at pgCon.&amp;nbsp; The winner will get some one-of-a-kind PostgreSQL and Schemaverse swag, and even runners up will get posters or tshirts.&lt;br /&gt;&lt;br /&gt;If you've already registered for pgCon, look for email from Dan Langille about how to sign up for the tournament.&amp;nbsp; In the meantime, get over to the Schemaverse website and practice your space battle skills to get ready for the big event.&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/7476449567742726187-3708443780211094101?l=www.databasesoup.com" alt="" /&gt;&lt;/div&gt;</description><guid isPermaLink="true">tag:blogger.com,1999:blog-7476449567742726187.post-3708443780211094101</guid><pubDate>Fri, 04 May 2012 05:41:05 GMT</pubDate></item><item><title>gabrielle roth: PDXPUG:  May meeting in two weeks</title><link>http://pdxpug.wordpress.com/2012/05/03/pdxpug-may-meeting-in-two-weeks/</link><description>&lt;p&gt;When: 7-9pm Thu May 17, 2012&lt;br /&gt;
Where: Iovation&lt;br /&gt;
Who: Ed Snajder&lt;br /&gt;
What: Replication Without Tears&lt;/p&gt;
&lt;p&gt;&amp;#8220;Database replication is a great way to tackle challenges with scaling, concurrency, availability and redundancy. It is common to all well-known database engines, and in Postgres, there are almost too many choices. In this demo-driven presentation, I will review a few of the options available for replication in PostgreSQL Systems. While the concept of replication is really quite straightforward, it can be unusually painful to configure and maintain. Furthermore, each particular method of replication includes its own significant pros and cons. My hope is that some of my discoveries will ease the pain and reduce the tears of configuring and managing your own replicated systems.&amp;#8221;&lt;/p&gt;
&lt;p&gt;Ed Snajder is the Database Administrator at Jive Software, and has been working with databases for over 10 years. His currently responsibility is predominantly PostgreSQL systems administration, though he still actively works through challenges with Oracle, SQL Server and MySql. A native New Yorker, Ed moved to Portland in 2006 and had the opportunity to operate as the DBA for the Systems running the &lt;a href="http://en.wikipedia.org/wiki/Coupon-eligible_converter_box" target="_blank"&gt;NTIA Analog-to-digital Convertor Box Program&lt;/a&gt;. Outside of technology, Ed enjoys music and sports appreciation, and recently started a grass-roots effort to officially rename Beaverton to &amp;#8220;The Tron.&amp;#8221;&lt;/p&gt;
&lt;p&gt;Our meeting will be held at Iovation, on the 32nd floor of the US Bancorp Tower at 111 SW 5th (5th &amp;amp; Oak).  It&amp;#8217;s right on the Green &amp;amp; Yellow Max lines.  Underground bike parking is available in the parking garage;  outdoors all around the block in the usual spots.  No bikes in the office, sorry!&lt;/p&gt;
&lt;p&gt;Building security will close access to the floor at 7:30.&lt;/p&gt;
&lt;p&gt;After-meeting beer location TBD.  See you there!&lt;/p&gt;
&lt;br /&gt;  &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pdxpug.wordpress.com/175/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pdxpug.wordpress.com/175/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pdxpug.wordpress.com/175/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pdxpug.wordpress.com/175/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pdxpug.wordpress.com/175/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pdxpug.wordpress.com/175/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pdxpug.wordpress.com/175/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pdxpug.wordpress.com/175/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pdxpug.wordpress.com/175/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pdxpug.wordpress.com/175/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pdxpug.wordpress.com/175/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pdxpug.wordpress.com/175/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pdxpug.wordpress.com/175/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pdxpug.wordpress.com/175/" /&gt;&lt;/a&gt; &lt;img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pdxpug.wordpress.com&amp;blog=30930172&amp;post=175&amp;subd=pdxpug&amp;ref=&amp;feed=1" width="1" height="1" /&gt;</description><guid isPermaLink="false">http://pdxpug.wordpress.com/?p=175</guid><pubDate>Fri, 04 May 2012 02:08:30 GMT</pubDate></item><item><title>Leo Hsu and Regina Obe: File FDW Family: Part 1 file_fdw</title><link>http://www.postgresonline.com/journal/archives/250-File-FDW-Family-Part-1-file_fdw.html</link><description>&lt;p&gt;Last time we demonstrated how to use the &lt;a href="http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wrapper---odbc_fdw-on-windows.html" target="_blank"&gt;ODBC Foreign Data wrapper&lt;/a&gt;, this time we'll continue our journey into Foreign Data Wrapper land by demonstrating what I'll call the &lt;em&gt;File FDW family of Foreign Data Wrappers&lt;/em&gt;.  There is one that usually comes packaged with PostgreSQL 9.1 which is called &lt;a href="http://www.postgresql.org/docs/9.1/interactive/file-fdw.html"&gt;&lt;em&gt;fdw_file&lt;/em&gt;&lt;/a&gt; but there are two other experimental ones I find very useful which are 
developed by Andrew Dunstan both of which Andrew demoed in &lt;a href="http://people.planetpostgresql.org/andrew/uploads/fdw2.pdf"&gt;PostgreSQL Foreign Data Wrappers&lt;/a&gt; and talked
about a little bit &lt;a href="http://people.planetpostgresql.org/andrew/index.php?/archives/260-Text-files-from-a-remote-source.html" target="_blank"&gt;Text files from a remote source&lt;/a&gt;.  As people who have to deal with text data files day in and out, especially ones from mainframes, these satisfy a certain itch.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;file_fdw - for querying delimited text files.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/adunstan/file_fixed_length_record_fdw" target="_blank"&gt;file_fixed_length_fdw&lt;/a&gt; - this one deals with fixed length data. We discussed methods of importing fixed length data in &lt;a href="http://www.postgresonline.com/journal/archives/157-Import-fixed-width-data-into-PostgreSQL-with-just-PSQL.html"&gt;Import Fixed width data&lt;/a&gt;.  This is yet another approach but has the benefit that you can also use it to import just a subset of a file. &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/adunstan/file_text_array_fdw" target="_blank"&gt;file_text_array_fdw&lt;/a&gt; - this one queries a delimited file as if each delimiete row was a text array.  It is ideal for those less than perfect moments when someone gives you a file with a 1000 columns and you don't have patience to look at what the hell those columns mean just yet.&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;
&lt;p&gt;In this article, we'll just cover the &lt;code&gt;file_fdw&lt;/code&gt; one, but will follow up in subsequent articles, demonstrating the array and fixed length record ones.&lt;/p&gt; &lt;br /&gt;&lt;a href="http://www.postgresonline.com/journal/archives/250-File-FDW-Family-Part-1-file_fdw.html#extended"&gt;Continue reading "File FDW Family: Part 1 file_fdw"&lt;/a&gt;</description><guid isPermaLink="false">http://www.postgresonline.com/journal/archives/250-guid.html</guid><pubDate>Thu, 03 May 2012 19:04:00 GMT</pubDate></item><item><title>Bruce Momjian: Starting on 9.2 Release Notes</title><link>http://momjian.us/main/blogs/pgblog/2012.html#May_3_2012</link><description>&lt;p&gt;As in previous years, I have started working on major release notes, this time for Postgres 9.2.  I start with this command:
&lt;/p&gt;
&lt;p&gt;&lt;blockquote&gt;
&lt;/p&gt;&lt;pre class="quote_explicit"&gt;
$ src/tools/git_changelog --since '2011-06-11 00:00:00 GMT' --master-only \
&amp;gt; --oldest-first --details-after
&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://momjian.us/main/blogs/pgblog/2012.html#May_3_2012"&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</description><guid isPermaLink="false">http://momjian.us/main/blogs/pgblog/2012.html#May_3_2012</guid><pubDate>Thu, 03 May 2012 14:00:01 GMT</pubDate></item><item><title>Bruce Momjian: Measuring Free Memory and Kernel Cache Size on Linux</title><link>http://momjian.us/main/blogs/pgblog/2012.html#May_2_2012</link><description>&lt;p&gt;Measuring Linux free memory and kernel cache size can be somewhat tricky.  You might look at /proc/meminfo for the answer (commas
added):
&lt;/p&gt;
&lt;p&gt;&lt;blockquote&gt;
&lt;/p&gt;&lt;pre class="quote_explicit"&gt;
# cat /proc/meminfo
MemTotal:       24,736,604 kB
MemFree:         3,805,392 kB
Buffers:           743,016 kB
Cached:         18,188,208 kB
...
&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://momjian.us/main/blogs/pgblog/2012.html#May_2_2012"&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</description><guid isPermaLink="false">http://momjian.us/main/blogs/pgblog/2012.html#May_2_2012</guid><pubDate>Wed, 02 May 2012 14:00:01 GMT</pubDate></item><item><title>Frank Wiles: Three things you should never put in your database</title><link>http://revsys.com/blog/2012/may/01/three-things-you-should-never-put-your-database/</link><description>&lt;p&gt;
As I've said in a few talks, the best way to improve your systems is by first not
doing "dumb things". I don't mean you or your development staff is "dumb", it's
easy to overlook the implications of these types of decisions and not realize how
bad they are for maintainability let alone scaling. As a consultant I see this stuff
all of the time and I have yet to ever see it work out well for anyone.
&lt;/p&gt;

&lt;h2&gt;Images, files, and binary data&lt;/h2&gt;
&lt;p&gt;
Your database supports BLOBs so it must be a good idea to shove your files in there
right? No it isn't! Hell it isn't even very convenient to use with many DB language
bindings.&lt;/p&gt;

&lt;p&gt;There are a few of problems with storing files in your database:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;read/write to a DB is always slower than a filesystem&lt;/li&gt;
    &lt;li&gt;your DB backups grow to be huge and more time consuming&lt;/li&gt;
    &lt;li&gt;access to the files now requires going through your app and DB layers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
The last two are the real killers.  Storing your thumbnail images in your database? Great
now you can't use nginx or another lightweight web server to serve them up.
&lt;/p&gt;

&lt;p&gt;
Do yourself a favor and store a simple relative path to your files on disk in the database or
use something like S3 or any CDN instead.
&lt;/p&gt;

&lt;h2&gt;Ephemeral data&lt;/h2&gt;

&lt;p&gt;
Usage statistics, metrics, GPS locations, session data anything that is only useful to you
for a short period of time or frequently changes. If you find yourself DELETEing an hour,
day, or weeks worth of some table with a cron job, you're using the wrong tool for the job.
&lt;/p&gt;
&lt;p&gt;
Use &lt;a href="http://redis.io"&gt;redis&lt;/a&gt;, &lt;a href="https://github.com/etsy/statsd"&gt;statsd&lt;/a&gt;/&lt;a href="http://graphite.wikidot.com/"&gt;graphite&lt;/a&gt;, &lt;a href="http://basho.com/products/riak-overview/"&gt;Riak&lt;/a&gt; anything else
that is better suited to that type of work load. The same advice goes for aggregations of ephemeral data 
that doesn't live for very long.
&lt;/p&gt;
&lt;p&gt;
Sure it's possible to use a &lt;a href="http://en.wikipedia.org/wiki/Backhoe"&gt;backhoe&lt;/a&gt; to plant some
tomatoes in the garden, but it's far faster to grab the shovel in the garage than schedule
time with a backhoe and have it arrive at your place and dig.  Use the right tool(s) for the
job at hand.
&lt;/p&gt;

&lt;h2&gt;Logs&lt;/h2&gt;

&lt;p&gt;
This one seems ok on the surface and the "I might need to use a complex query on them at
some point in the future" argument seems to win people over. Storing your logs in a database
isn't a HORRIBLE idea, but storing them in the same database as your other production data
is.
&lt;/p&gt;

&lt;p&gt;
Maybe you're conservative with your logging and only emit one log line per web request normally.
That is still generating a log INSERT for every action on your site that is competing for resources
that your users could be using. Turn up your logging to a verbose or debug level and watch your
production database catch on fire!
&lt;/p&gt;

&lt;p&gt;
Instead use something like &lt;a href="http://splunk.com"&gt;Splunk&lt;/a&gt;, &lt;a href="http://loggly.com"&gt;Loggly&lt;/a&gt;
or plain old rotating flat files for your logs. The few times you need to inspect them in odd ways,
even to the point of having to write a bit of code to find your answers, is easily outweighed by the 
constant resources it puts on your system.
&lt;/p&gt;

&lt;p&gt;
But wait, you're a unique snowflake and your problem is SO different that it's ok for you to do
one of these three.  &lt;strong&gt;No you aren't and no it really isn't&lt;/strong&gt;.  Trust me.
&lt;/p&gt;</description><guid isPermaLink="false">http://revsys.com/blog/2012/may/01/three-things-you-should-never-put-your-database/</guid><pubDate>Tue, 01 May 2012 21:24:03 GMT</pubDate></item><item><title>David Wheeler: Sqitch Status: A Step at a Time</title><link>http://feedproxy.google.com/~r/justatheory/pgsum/~3/DeC0DdLk4ZM/sqitch-steps.html</link><description>&lt;div&gt;&lt;p&gt;I've just released &lt;a href="http://search.cpan.org/dist/App-Sqitch-0.20-TRIAL/"&gt;Sqitch v0.20-TRIAL&lt;/a&gt;, the third testing release of Sqitch. Since last week, I've implemented &lt;a href="http://search.cpan.org/dist/App-Sqitch-0.20-TRIAL/lib/sqitch-add-step.pod"&gt;&lt;code&gt;add-step&lt;/code&gt;&lt;/a&gt;. So let's have a look-see at what all it can do. First, let's initialize a Sqitch project.&lt;/p&gt;&lt;p&gt;&lt;a href="http://justatheory.com/computers/databases/sqitch-steps.html"&gt;Read More »&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/justatheory/pgsum/~4/DeC0DdLk4ZM" height="1" width="1" /&gt;&lt;/div&gt;</description><guid isPermaLink="true">tag:justatheory.com,2012:/computers/databases/sqitch-steps</guid><pubDate>Tue, 01 May 2012 04:09:00 GMT</pubDate></item></channel></rss>
