pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Matteo Beccati <php@beccati.com>
Cc: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Re: Errors on CREATE TABLE IF NOT EXISTS
Date: Tue, 01 May 2012 15:36:24 -0400
Message-ID: <1335900770-sup-854@alvh.no-ip.org> (raw)
In-Reply-To: <4F9541D3.1000202@beccati.com>
References: <4F9541D3.1000202@beccati.com>


Excerpts from Matteo Beccati's message of lun abr 23 08:49:39 -0300 2012:
> Hi,
> 
> I've recently seen a few errors on our continuous integration system 
> during a test using a badly written partitioning trigger. The function 
> was basically checking for the existence of the partition table at every 
> insert and was running a CREATE TABLE IF NOT EXISTS statement in case it 
> was needed. What baffled me was that the function was exiting with an 
> ERROR, rather than succeeding with a NOTICE, e.g.:

The question you were asking has already been answered, but I think it's
worth pointing out that a partitioned-insert trigger that has to check
whether the partition exist beforehand is a lot slower than one that
doesn't have to.  Our usual suggestion is to create the partitions by
some other means, e.g. create a couple months worth of weekly
partitions, a couple of months ahead of time, via cron.  The insert
trigger is then assured that the partition exists, and it can become
faster by not having to check.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



view thread (6+ messages)  latest in thread

Message-ID: <1335900770-sup-854@alvh.no-ip.org>
Permalink:  ../1335900770-sup-854@alvh.no-ip.org/
Also on:    postgresql.org/message-id/1335900770-sup-854@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@commandprompt.com, php@beccati.com
  Subject: Re: Errors on CREATE TABLE IF NOT EXISTS
  In-Reply-To: <1335900770-sup-854@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox