Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tu7Uw-0006pE-QN for pgsql-performance@arkaria.postgresql.org; Sat, 12 Jan 2013 20:16:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tu7Uw-0000ry-3J for pgsql-performance@arkaria.postgresql.org; Sat, 12 Jan 2013 20:16:10 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tu7Uv-0000rt-3l for pgsql-performance@postgresql.org; Sat, 12 Jan 2013 20:16:09 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tu7Ut-0004xo-8m for pgsql-performance@postgresql.org; Sat, 12 Jan 2013 20:16:08 +0000 Received: by mail-wi0-f179.google.com with SMTP id o1so506174wic.0 for ; Sat, 12 Jan 2013 12:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :cc:content-transfer-encoding:message-id:references:to:x-mailer; bh=WMrWyr0haacsKZ2qZoFOmN6zbq4yw6BfSgN32txd13Y=; b=Bido7SHbHqsLY4bK5WtmhN7bJIAySELHITZjvNW9lCqHYuXA/V2dNUFXUg/uu+3cO+ gka9pxDa8IlnUE/N3aaqqH5eHcT6UNoHqW1qLjyfjYS4MMmyAs1A8ZOT1fBRRs+BSELa y9RmQ8ppIQG0hdtSA40ftaOw7ASVvakXN+fl1IBNqVDz55uB4Gec9LnGCyLwMN5GoaGj VS1OSIt1KWLvhjKXFsbsHT2TWGo6yVIECbEePPwbBPo4j26YRGQOqiKcmCrPUY8Mmi8n FKdOqm/2nsPBtUQvrTZ8g69iFmKjJ2x3Rl5NP8GvbauzEIdwfo1R3B5rNbhAsethRJaG Y8dA== X-Received: by 10.194.87.200 with SMTP id ba8mr127808903wjb.22.1358021765487; Sat, 12 Jan 2013 12:16:05 -0800 (PST) Received: from [192.168.1.77] (10.Red-79-154-233.dynamicIP.rima-tde.net. [79.154.233.10]) by mx.google.com with ESMTPS id bd7sm5721210wib.8.2013.01.12.12.16.03 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 12 Jan 2013 12:16:04 -0800 (PST) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: Insert performance for large transaction with multiple COPY FROM From: Horst Dehmer In-Reply-To: Date: Sat, 12 Jan 2013 21:16:02 +0100 Cc: postgres performance list Content-Transfer-Encoding: quoted-printable Message-Id: <9F5056DC-8089-40A5-8D41-508EADC63A09@gmail.com> References: <78A65A52-C49D-4CA4-9A63-1F5F120BC7E7@gmail.com> To: Claudio Freire X-Mailer: Apple Mail (2.1499) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Yes, the ids is something I don't like either. They carry additional semantics, which I cannot make go away. How are chances char(20) is more time efficient than numeric(20)? Disk space is no problem here. On 12.01.2013, at 02:17, Claudio Freire wrote: > On Fri, Jan 11, 2013 at 8:55 PM, Horst Dehmer wr= ote: >> Except - and that's the wall I'm hitting - for one table which yielded j= ust >> 75 records/second. >> The main 'problem' seem to be the FK constraints. Dropping just them >> restored insert performance for this table to 6k records/s. The table in >> question has a composite PK (3 columns), 3 foreign keys and a bunch of >> indexes (see table obj_item_loc at the end of the mail). Compared to the >> other 32 tables nothing unusual. >> I'd gladly supply more information if necessary. > ... >> CREATE TABLE obj_item_loc >> ( >> obj_item_id numeric(20,0) NOT NULL, >> loc_id numeric(20,0) NOT NULL, >> obj_item_loc_ix numeric(20,0) NOT NULL, >=20 > That sounds a lot like a missing index on the target relations (or > indices that are unusable). >=20 > Those numeric ids look really unusual. Why not bigint? It's close to > the same precision, but native, faster, more compact, and quite > unambiguous when indices are involved. If the types don't match on > both tables, it's quite likely indices won't be used when checking the > FK, and that spells trouble. --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance