Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9EC52B5DC0D for ; Sun, 31 Jul 2011 10:47:57 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 42602-07 for ; Sun, 31 Jul 2011 13:47:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id F205CB5D8C5 for ; Sun, 31 Jul 2011 10:47:56 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p6VDlubo017166 for ; Sun, 31 Jul 2011 13:47:56 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p6VDlu0f017165; Sun, 31 Jul 2011 13:47:56 GMT (envelope-from www) Date: Sun, 31 Jul 2011 13:47:56 GMT Message-Id: <201107311347.p6VDlu0f017165@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6136: Perfomance dies when using PK on 64-bit field From: "Robert" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201108/2 X-Sequence-Number: 30814 The following bug has been logged online: Bug reference: 6136 Logged by: Robert Email address: robert.ayrapetyan@gmail.com PostgreSQL version: 9.0.4 Operating system: FreeBSD 8.2 64 bit Description: Perfomance dies when using PK on 64-bit field Details: I've found strange behavior of my pg installation (tested both 8.4 and 9.0 - they behave same) on FreeBSD platform. In short - when some table have PK on bigint field - COPY to that table from file becomes slower and slower as table grows. When table reaches ~5GB - COPY of 100k records may take up to 20 mins. I've experimented with all params in configs, moved indexes to separate hdd etc - nothing made any improvement. However, once I'm dropping 64 bit PK - COPY of 100k records passes in seconds. Interesting thing - same table has other indexes, including composite ones, but none of them include bigint fields, that's why I reached decision that bug connected with indexes on bigint fields only. In terms of IO picture is following: after copy started gstat shows 100% load on index partition (as I mentioned above - I've tried separate hdd to keep index tablespace), large queue (over 2k elements), and constant slow write on speed of ~2MB\s. Hdd becomes completely unresponsive, even ls on empty folder hangs for minute or so. To avoid thoughts like "your hdd is slow, you haven't tuned postgresql.conf etc" - all slowness dissapears with drop of bigint PK, same time other indexes on same table remain alive. And yes - I've tried drop PK \ recreate PK, vacuum full analyze and all other things - nothing helped, only drop helps.