Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 33858EC7B26 for ; Fri, 6 Jul 2012 11:14:45 -0300 (ADT) Received: from moutng.kundenserver.de ([212.227.126.186]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sn9Ix-0002qM-K9 for pgsql-performance@postgresql.org; Fri, 06 Jul 2012 14:14:44 +0000 Received: from awork2.localnet (p5DDC4F29.dip.t-dialin.net [93.220.79.41]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MPKo0-1SijSO0adE-004Orf; Fri, 06 Jul 2012 16:14:28 +0200 From: Andres Freund Organization: 2ndquadrant.com To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL db, 30 tables with number of rows < 100 (not huge) - the fastest way to clean each non-empty table and reset unique identifier column of empty ones. Date: Fri, 6 Jul 2012 16:14:26 +0200 User-Agent: KMail/1.13.7 (Linux/3.4.0-andres; KDE/4.8.4; x86_64; ; ) Cc: Daniel Farina , Craig Ringer , Stanislaw Pankevich References: <4FF6CC11.2000904@ringerc.id.au> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201207061614.26739.andres@2ndquadrant.com> X-Provags-ID: V02:K0:JtUpmXnUNpM/niW1c+ckDXmZqq4GQBh1CjcRfqekuTT NcWISTLbHggJfoF3HF9OABTGAWPMkKd1APXuLsiuHeFacw1bF1 Db4131UkrLS4tKB+lZaxkEcHck9zG02j5r/9xJkj9FAkkDEwzC HUZYto7XhGWxzAGU051FMdp0Bi3/bXGEghJvbPbXwwgsKN6ElH bu6eeW0YmUFj+1KSJgbK8TbqmPzIqfVSmT+QPRsxUC+ZebOeiG C8a1gu7dWY7gf1tl8mHBNzDpc/LX9Ev8q9cXF627FvjfK2kJjP BSiY0D4SWsScXctlkGIY0u604jAyPD9/gbKJYITaOWX7VxV/1q K9R0Q6W6PmoyDnpiqf8XVhbKuPRHS6d6c8xvCuaHR X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/63 X-Sequence-Number: 47244 On Friday, July 06, 2012 01:38:56 PM Daniel Farina wrote: > ll, I don't know a > mechanism besides slow file system truncation time that would explain > why DELETE would be significantly faster. There is no filesystem truncation happening. The heap and the indexes get mapped into a new file. Otherwise rollback would be pretty hard to implement. I guess the biggest cost in a bigger cluster is the dropping the buffers that were formerly mapped to that relation (DropRelFileNodeBuffers). Andres -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services