Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id C3A2E16137F6 for ; Wed, 2 May 2012 14:08:40 -0300 (ADT) Received: from spritz.beccati.com ([176.9.114.167] helo=mail.beccati.com) by makus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1SPd2c-000052-KF for pgsql-bugs@postgresql.org; Wed, 02 May 2012 17:08:40 +0000 Received: (qmail 29664 invoked from network); 2 May 2012 17:08:20 -0000 Received: from home.beccati.com (HELO ?192.168.1.202?) (88.149.176.119) by mail.beccati.com with SMTP; 2 May 2012 17:08:20 -0000 Message-ID: <4FA16A02.10109@beccati.com> Date: Wed, 02 May 2012 19:08:18 +0200 From: Matteo Beccati User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: Alvaro Herrera CC: Pg Bugs Subject: Re: Errors on CREATE TABLE IF NOT EXISTS References: <4F9541D3.1000202@beccati.com> <1335900770-sup-854@alvh.no-ip.org> In-Reply-To: <1335900770-sup-854@alvh.no-ip.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/6 X-Sequence-Number: 32977 Hi Alvaro, On 01/05/2012 21:36, Alvaro Herrera wrote: > 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. Thanks for the suggestion. I will surely follow the advice as soon as the load starts to grow. For now catching the "table not found" exception within the insert trigger and creating the table on the fly seems a good balance between performance and ease of use. Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/