Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id AB32817A3628 for ; Wed, 11 Jul 2012 17:47:40 -0300 (ADT) Received: from smtp2.peak6.com ([38.98.137.9]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sp3ou-00058P-9s for pgsql-performance@postgresql.org; Wed, 11 Jul 2012 20:47:39 +0000 X-AuditID: 0a02cb1e-b7f986d000000c8c-b1-4ffde656a6ff Message-ID: <4FFDE659.7040104@optionshouse.com> Date: Wed, 11 Jul 2012 15:47:21 -0500 From: Shaun Thomas Reply-To: Organization: Peak6 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Craig James CC: Tom Lane , Daniel Farina , Craig Ringer , "pgsql-performance@postgresql.org" Subject: Re: DELETE vs TRUNCATE explanation References: <4FFCCAC4.4030503@ringerc.id.au> <23853.1342015548@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.201.64] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRmVeSWpSXmKPExsXClcIroRv+7K+/wZP/zBb7V2xltPi14RG7 xfWZ55gtLh14ymRxatVdJgdWjys7jzN6HL17m83jwr5p7B6zpk9k9Fj0bCNLAGtUA6NNYl5e fkliSapCSmpxsq2Sf0FJZn5esUd+aXGqgktmcXJOYmZuapGSQmaKrZK5kkJBTmJyam5qXomt UmJBQWpeipIdlwIGsAEqy8xTSM1Lzk/JzEu3VfIM9te1sDC11DVUsotHBgmdLBnT2t6wFfSx V/x8tJG1gfEmaxcjJ4eEgInEmZVXmCBsMYkL99azgdi8AvoSL1vPg8VZBFQl/v0/xwxiswno SkzqXwFWIySgItF39gZYDb+AsMS+D01gNaICIRINXf9ZIeYISpyc+YQFxBYRUJfo7JoBVs8s sIVR4uVvpy5GDg5hAVOJQ+vjuhi5gEZeZ5SYdWw22BxOgUCJbReXQdXbSlyYc50FwpaX2P52 DjPEDaoSK5onskHcryDx/8o7pgmMQrOQrJ6FpH0WkvYFjMyrGMWLyxKTMzLNCopzSwoM9QpS E7PN9PJSSzYxgqKe6bTcDsYVFxQPMQpwMCrx8Aps/OsvxJpYVlyZe4hRgoNZSYS3fAJQiDcl sbIqtSg/vqg0J7X4EKMpMMwmMkuJJucDE1JeSbyhsaGlqaWJmaW5sbGBkjhvbDNQk0A6MDlk p6YWpBbB9DFxcEo1MFYIusUWTevePsM6Vbm46jO7w4SSnesuHArv+M9UczFj5fQ1Cg8uLp6u z24ybcIzC/+ehwVtYbkpYtmWptnbv2ZMXFy50D1kaYOwx9dXU731vl6cKbXbeRn74297S0vu 3Tgpy3bJsXRR2xTGsjI1i2Myas1NwSn7H177FVD1UFpjlkXjtEMxKkosxRmJhlrMRcWJALWS 3/AQAwAA X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/138 X-Sequence-Number: 47319 On 07/11/2012 03:18 PM, Craig James wrote: > It strikes me as a contrived case rather than a use case. What sort of > app repeatedly fills and truncates a small table thousands of times ... > other than a test app to see whether you can do it or not? Test systems. Any company with even a medium-size QA environment will have continuous integration systems that run unit tests on a trash database hundreds or thousands of times through the day. Aside from dropping/creating the database via template, which would be *really* slow, truncate is the easiest/fastest way to reset between tests. If TRUNCATE suddenly started defaulting to DELETE on small table-sets and several iterations led to exponential index growth, that would be rather unfortunate. -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604 312-444-8534 sthomas@optionshouse.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email