Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id B4E8755C5A5 for ; Mon, 16 Jul 2012 16:16:30 -0300 (ADT) Received: from mail-ee0-f46.google.com ([74.125.83.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SqqmR-0005Fp-EY for pgsql-performance@postgresql.org; Mon, 16 Jul 2012 19:16:29 +0000 Received: by eekc13 with SMTP id c13so306209eek.19 for ; Mon, 16 Jul 2012 12:16:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=UzIbHUKcmg6H0MPSUJASUj1i3DcjsXk5Q5vbSwGuhok=; b=PzDUd8vLt1vQJcu9DNmablRgXnqbolilqWx6i2cmcLGF84ySZsCE4raXK1jzWxnzfQ 5niSfz1LfajWXBst77cE35K0Dj4auHPVDOkkuTIQ90WB6gpJXXh58g2u3x7UFKEBggfr COFMBHAZ2IJc1ED1cRVD55YoYI9ZFtkkvXawg7X6V/rIVwyPoqNfegZwYKhni0EGO9ou T5ye5r1dU9+dnLMBoZE03vjl7ay+HJYvg99XZjSQQhBgTDphb4gUemP97vRGJWeKxqPd 9iH4uvJIj7+hLjKsNhkEM+VfWkiAI+TkVp+jLH25bgPR/68MVr0JgSPfZGg8GfLze4Lx 8eDw== Received: by 10.14.179.198 with SMTP id h46mr10695610eem.45.1342466174348; Mon, 16 Jul 2012 12:16:14 -0700 (PDT) Received: from [192.168.0.110] (cpc4-ware5-2-0-cust97.9-1.cable.virginmedia.com. [86.5.172.98]) by mx.google.com with ESMTPS id c1sm21295127eeo.5.2012.07.16.12.16.12 (version=SSLv3 cipher=OTHER); Mon, 16 Jul 2012 12:16:13 -0700 (PDT) Message-ID: <5004687B.8080908@optrak.com> Date: Mon, 16 Jul 2012 20:16:11 +0100 From: Mark Thornton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Claudio Freire CC: Jon Nelson , pgsql-performance@postgresql.org Subject: Re: very very slow inserts into very large table References: <50041FD1.5070002@optrak.com> <5004647B.3090308@optrak.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQm5UkqsnpZhnt2iV2WYgYeXHcOmoXqBD13aiixRk9fNddBz8q8EttQ/AHqJWZWNEXXfRevw X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201207/200 X-Sequence-Number: 47381 On 16/07/12 20:08, Claudio Freire wrote: > On Mon, Jul 16, 2012 at 3:59 PM, Mark Thornton wrote: >> 4. The most efficient way for the database itself to do the updates would be >> to first insert all the data in the table, and then update each index in >> turn having first sorted the inserted keys in the appropriate order for that >> index. > Actually, it should create a temporary index btree and merge[0] them. > Only worth if there are really a lot of rows. > > [0] http://www.ccs.neu.edu/home/bradrui/index_files/parareorg.pdf I think 93 million would qualify as a lot of rows. However does any available database (commercial or open source) use this optimisation. Mark