Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 7324A9FB32B for ; Sun, 27 May 2007 14:31:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 32830-07 for ; Sun, 27 May 2007 14:31:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from h07.llord.com (unknown [195.140.142.194]) by postgresql.org (Postfix) with ESMTP id E93F99FB322 for ; Sun, 27 May 2007 14:31:52 -0300 (ADT) Received: from par69-8-88-161-102-87.fbx.proxad.net ([88.161.102.87] helo=apollo13) by h07.llord.com with esmtpa (Exim 4.66) (envelope-from ) id 1HsMak-0001KE-2x; Sun, 27 May 2007 19:31:42 +0200 Date: Sun, 27 May 2007 19:34:30 +0200 To: "Jim C. Nasby" Subject: Re: Feature suggestion : FAST CLUSTER From: PFC Cc: "pgsql-performance@postgresql.org" Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <20070527155338.GM92628@nasby.net> Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: <20070527155338.GM92628@nasby.net> User-Agent: Opera Mail/9.10 (Linux) X-PopBeforeSMTPSenders: junk@peufeu.com, lists@peufeu.com, peufeu@peufeu.com, pfcaillaud@peufeu.com X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - h07.llord.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - peufeu.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.955 tagged_above=0 required=5 tests=AWL=0.779, BAYES_00=-2.599, RCVD_IN_NJABL_SPAM=2.775 X-Spam-Level: X-Archive-Number: 200705/565 X-Sequence-Number: 24955 On Sun, 27 May 2007 17:53:38 +0200, Jim C. Nasby wrote: > On Tue, May 22, 2007 at 09:29:00AM +0200, PFC wrote: >> This does not run a complete sort on the table. It would be about as >> fast as your seq scan disk throughput. Obviously, the end result is >> not as >> good as a real CLUSTER since the table will be made up of several >> ordered >> chunks and a range lookup. Therefore, a range lookup on the clustered >> columns would need at most N seeks, versus 1 for a really clustered >> table. >> But it only scans the table once and writes it once, even counting index >> rebuild. > > Do you have any data that indicates such an arrangement would be > substantially better than less-clustered data? While the little benchmark that will answer your question is running, I'll add a few comments : I have been creating a new benchmark for PostgreSQL and MySQL, that I will call the Forum Benchmark. It mimics the activity of a forum. So far, I have got interesting results about Postgres and InnoDB and will publish an extensive report with lots of nasty stuff in it, in, say, 2 weeks, since I'm doing this in spare time. Anyway, forums like clustered tables, specifically clusteriing posts on (topic_id, post_id), in order to be able to display a page with one disk seek, instead of one seek per post. PostgreSQL humiliates InnoDB on CPU-bound workloads (about 2x faster since I run it on dual core ; InnoDB uses only one core). However, InnoDB can automatically cluster tables without maintenance. This means InnoDB will, even though it sucks and is awfully bloated, run a lot faster than postgres if things become IO-bound, ie. if the dataset is larger than RAM. Postgres needs to cluster the posts table in order to keep going. CLUSTER is very slow. I tried inserting into a new posts table, ordering by (post_id, topic_id), then renaming the new table in place of the old. It is faster, but still slow when handling lots of data. I am trying other approaches, some quite hack-ish, and will report my findings. Regards