Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id BD7172E0144 for ; Tue, 3 Jun 2008 21:08:31 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 80503-02-3 for ; Tue, 3 Jun 2008 21:08:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 30.mail-out.ovh.net (30.mail-out.ovh.net [213.186.62.213]) by developer.postgresql.org (Postfix) with SMTP id EBC692E0045 for ; Tue, 3 Jun 2008 21:07:44 -0300 (ADT) Received: (qmail 3824 invoked by uid 503); 4 Jun 2008 00:08:03 -0000 Received: from unknown (HELO mail243.ha.ovh.net) (213.186.33.59) by 30.mail-out.ovh.net with SMTP; 4 Jun 2008 00:08:03 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 4 Jun 2008 00:07:36 -0000 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13.peufeu.com) (88.161.102.87) by ns0.ovh.net with SMTP; 4 Jun 2008 00:07:35 -0000 Date: Wed, 04 Jun 2008 02:15:10 +0200 To: "andrew klassen" , pgsql-performance@postgresql.org Subject: Re: insert/update tps slow with indices on table > 1M rows From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <691681.3510.qm@web37304.mail.mud.yahoo.com> Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <691681.3510.qm@web37304.mail.mud.yahoo.com> User-Agent: Opera Mail/9.24 (Linux) X-Ovh-Tracer-Id: 15908402735668135556 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.633 tagged_above=0 required=5 tests=AWL=0.633 X-Spam-Level: X-Archive-Number: 200806/14 X-Sequence-Number: 30364 On Wed, 04 Jun 2008 00:36:09 +0200, andrew klassen wrote: > Running postgres 8.2.5 >   > I have a table that has 5 indices, no foreign keys or any > dependency on any other table. If delete the database and > start entering entries, everything works very well until I get > to some point (let's say 1M rows). Basically, I have a somewhat > constant rate of inserts/updates that go into a work queue and then > get passed to postgres. The work queue starts filling up as the > responsiveness slows down. For example at 1.5M > rows it takes >2 seconds for 300 inserts issued in one transaction. >   > Prior to this point I had added regular VACUUM ANALYZE on > the table and it did help.  I increased maintenance work memory to > 128M. I also set the fillfactor on the table indices to 50% (not sure > if that made any difference have to study results more closely).  >   > In an effort to figure out the bottleneck, I DROPed 4 of the indices > on the table and the tps increased to over 1000. I don't really know > which index removal gave the best performance improvement. I > dropped 2 32-bit indices and 2 text indices which all using btree. >   > The cpu load is not that high, i.e. plenty of idle cpu. I am running an > older > version of freebsd and the iostat output is not very detailed. > During this time, the number is low < 10Mbs. The system has an > LSI Logic MegaRAID controller with 2 disks. >   > Any ideas on how to find the bottleneck/decrease overhead of index usage. >   > Thanks. If you are filling an empty table it is generally faster to create the indexes after the data import. Of course if this is a live table or you need the indexes during the import, this is not an option. I find it generally faster to lightly preprocess the data and generate text files that I then import using COPY, then doing the rest of the processing in SQL. How much RAM in the box ? size of the data & indexes ?