Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 121AD9FB8DC for ; Thu, 11 Oct 2007 12:53:29 -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 59914-01 for ; Thu, 11 Oct 2007 12:53:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 404A69FB38F for ; Thu, 11 Oct 2007 12:53:16 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l9BFr5Ys021654; Thu, 11 Oct 2007 11:53:05 -0400 (EDT) To: Benjamin Arai cc: Benjamin Arai , Oleg Bartunov , PostgreSQL , pgsql-performance@postgresql.org Subject: Re: [PERFORM] Slow TSearch2 performance for table with 1 million documents. In-reply-to: <3E8290A0-05DA-4F0F-A783-859124278D27@benjaminarai.com> References: <16663.1191597165@sss.pgh.pa.us> <6936504E-3560-4BE9-86BE-BEDAB3CD355A@araisoft.com> <3E8290A0-05DA-4F0F-A783-859124278D27@benjaminarai.com> Comments: In-reply-to Benjamin Arai message dated "Thu, 11 Oct 2007 07:52:29 -0700" Date: Thu, 11 Oct 2007 11:53:05 -0400 Message-ID: <21653.1192117985@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/506 X-Sequence-Number: 121798 Benjamin Arai writes: > It appears that the ORDER BY rank operation is the slowing factor. > If I remove it then the query is pretty fast. Is there another way > to perform ORDER BY such that it does not do a sort? I think you misunderstood: it's not the sort that's slow, it's the computation of the rank() values that are inputs to the sort. regards, tom lane