Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id CB4C1633177 for ; Wed, 9 Jun 2010 04:46:09 -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 53113-09 for ; Wed, 9 Jun 2010 07:46:02 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id 45D8663265D for ; Wed, 9 Jun 2010 04:46:02 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.4/8.14.4) with ESMTP id o597jw47088084 for ; Wed, 9 Jun 2010 04:45:59 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.4/8.14.4/Submit) id o597jiQ1087419 for pgsql-performance@postgresql.org; Wed, 9 Jun 2010 04:45:44 -0300 (ADT) (envelope-from news) From: =?UTF-8?B?VG9yc3RlbiBaw7xobHNkb3JmZg==?= X-Newsgroups: pgsql.performance Subject: Re: How to insert a bulk of data with unique-violations very fast Date: Wed, 09 Jun 2010 09:45:46 +0200 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: <4C07E418.80103@meisterderspiele.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 9 Jun 2010 07:45:46 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="AnkPUomeHXvuN7UdHvIkog"; logging-data="32445"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3dpIrOQjrCYhnWap5dKGw" User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.5.0 In-Reply-To: Cancel-Lock: sha1:qyiKLDkkw1xrRzJCZ3kvVFuzEyM= To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.79 tagged_above=-10 required=5 tests=BAYES_50=0.8, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/134 X-Sequence-Number: 38990 Pierre C schrieb: > >> Within the data to import most rows have 20 till 50 duplicates. >> Sometime much more, sometimes less. > > In that case (source data has lots of redundancy), after importing the > data chunks in parallel, you can run a first pass of de-duplication on > the chunks, also in parallel, something like : > > CREATE TEMP TABLE foo_1_dedup AS SELECT DISTINCT * FROM foo_1; > > or you could compute some aggregates, counts, etc. Same as before, no > WAL needed, and you can use all your cores in parallel. > > From what you say this should reduce the size of your imported data by > a lot (and hence the time spent in the non-parallel operation). Thank you very much for this advice. I've tried it inanother project with similar import-problems. This really speed the import up. Thank everyone for your time and help! Greetings, Torsten -- http://www.dddbl.de - ein Datenbank-Layer, der die Arbeit mit 8 verschiedenen Datenbanksystemen abstrahiert, Queries von Applikationen trennt und automatisch die Query-Ergebnisse auswerten kann.