X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 959965E46CD for ; Fri, 13 Aug 2004 09:41:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46824-03 for ; Fri, 13 Aug 2004 12:41:21 +0000 (GMT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id C050E5E37CB for ; Fri, 13 Aug 2004 09:41:16 -0300 (ADT) Received: from tmsl-adsl.demon.co.uk ([80.177.114.181] helo=bacon.tmsl.demon.co.uk) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 1BvbN2-0004GF-0X; Fri, 13 Aug 2004 12:41:20 +0000 Date: Fri, 13 Aug 2004 13:41:15 +0100 From: Paul Thomas To: Ulrich Wisser Cc: "pgsql-performance @ postgresql . org" , pgsql-performance@postgresql.org Subject: Re: insert Message-ID: <20040813134115.A12181@bacon> References: <20040813111649.7B4116C4F8@tino.sinectis.com.ar> <00cc01c4812b$4e7f02e0$0100000a@wp2000> <411CAFA3.90005@relevanttraffic.se> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 In-Reply-To: <411CAFA3.90005@relevanttraffic.se>; from ulrich.wisser@relevanttraffic.se on Fri, Aug 13, 2004 at 13:10:11 +0100 X-Mailer: Balsa 1.2.3 Lines: 24 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/202 X-Sequence-Number: 7838 On 13/08/2004 13:10 Ulrich Wisser wrote: > Hi, > > my inserts are done in one transaction, but due to some foreign key > constraints and five indexes sometimes the 100 inserts will take more > than 5 minutes. Two possibilities come to mind: a) you need an index on the referenced FK field b) you have an index but a type mis-match (e.g, an int4 field referencing an int8 field) Either of these will cause a sequential table scan and poor performance. -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+