Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 451A02E0067 for ; Thu, 22 May 2008 10:14:58 -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 56704-10 for ; Thu, 22 May 2008 10:14:34 -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 developer.postgresql.org (Postfix) with ESMTP id 37F702E004A for ; Thu, 22 May 2008 10:14:40 -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 m4MDEase029530; Thu, 22 May 2008 09:14:37 -0400 (EDT) To: "Guillaume Smet" cc: pgsql-performance Subject: Re: Index creation time and distribution In-reply-to: <1d4e0c10805220532v514c2bd5je4c6c20ceb485495@mail.gmail.com> References: <1d4e0c10805220532v514c2bd5je4c6c20ceb485495@mail.gmail.com> Comments: In-reply-to "Guillaume Smet" message dated "Thu, 22 May 2008 14:32:27 +0200" Date: Thu, 22 May 2008 09:14:36 -0400 Message-ID: <29529.1211462076@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/304 X-Sequence-Number: 30272 "Guillaume Smet" writes: > I experienced this morning a performance problem when we imported a > dump in a 8.1 database. > The table is 5 millions rows large and when the dump creates an index > on a specific text column called clazz it takes 27 minutes while on > the other columns, it only takes a couple of seconds: > The only weird thing about this column is that 4.7 millions of rows > have the exact same value. Do you have maintenance_work_mem set large enough that the index creation sort is done in-memory? 8.1 depends on the platform's qsort and a lot of them are kinda pessimal for input like this. 8.2 (which uses our own qsort) seems to perform better in a quick test. regards, tom lane