Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id E7E99634528 for ; Wed, 18 Mar 2009 00:25:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 16880-04 for ; Wed, 18 Mar 2009 00:25:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 7F86C63449D for ; Wed, 18 Mar 2009 00:25:01 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n2I3OxC5001805; Tue, 17 Mar 2009 23:24:59 -0400 (EDT) To: Ron Mayer cc: Oleg Bartunov , Teodor Sigaev , pgsql-performance@postgreSQL.org Subject: Re: Extremely slow intarray index creation and inserts. In-reply-to: <49BFEBD3.4000006@cheapcomplexdevices.com> References: <49BFD950.5040905@cheapcomplexdevices.com> <49BFEBD3.4000006@cheapcomplexdevices.com> Comments: In-reply-to Ron Mayer message dated "Tue, 17 Mar 2009 11:28:35 -0700" Date: Tue, 17 Mar 2009 23:24:59 -0400 Message-ID: <1804.1237346699@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL=0.012 X-Spam-Level: X-Archive-Number: 200903/240 X-Sequence-Number: 33162 Ron Mayer writes: > vm=# create index "gist70000" on tmp_intarray_test using GIST (my_int_array gist__int_ops); > CREATE INDEX > Time: 2069836.856 ms > Is that expected, or does it sound like a bug to take over > half an hour to index 70000 rows of mostly 5 and 6-element > integer arrays? I poked at this example with oprofile. It's entirely CPU-bound AFAICT, and the CPU utilization is approximately 55% g_int_compress 35% memmove/memcpy (difficult to distinguish these) 1% pg_qsort <1% anything else Probably need to look at reducing the number of calls to g_int_compress ... it must be getting called a whole lot more than once per new index entry, and I wonder why that should need to be. regards, tom lane