Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3hsd-0003H1-6J for pgsql-performance@arkaria.postgresql.org; Fri, 08 Feb 2013 06:56:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U3hsc-000734-Fc for pgsql-performance@arkaria.postgresql.org; Fri, 08 Feb 2013 06:56:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3hsa-00070e-AS for pgsql-performance@postgresql.org; Fri, 08 Feb 2013 06:56:12 +0000 Received: from 2605ds1-ynoe.3.fullrate.dk ([90.185.142.83] helo=shrek.krogh.cc) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3hsW-0001Fm-RD for pgsql-performance@postgresql.org; Fri, 08 Feb 2013 06:56:11 +0000 Received: from localhost (localhost [127.0.0.1]) by shrek.krogh.cc (Postfix) with ESMTP id 2DA22C44004; Fri, 8 Feb 2013 07:56:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at shrek.krogh.cc Received: from shrek.krogh.cc ([127.0.0.1]) by localhost (shrek.krogh.cc [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5RweUvDykAhl; Fri, 8 Feb 2013 07:56:03 +0100 (CET) Received: from [90.185.142.91] (2605ds1-ynoe.4.fullrate.dk [90.185.142.91]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jesper@krogh.cc) by shrek.krogh.cc (Postfix) with ESMTPSA id 803FDC44003; Fri, 8 Feb 2013 07:56:03 +0100 (CET) Message-ID: <5114A183.3090502@krogh.cc> Date: Fri, 08 Feb 2013 07:56:03 +0100 From: Jesper Krogh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Stefan Keller , "pgsql-performance@postgresql.org" Subject: Re: FTS performance issue probably due to wrong planner estimate of detoasting References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 08/02/13 01:52, Stefan Keller wrote: > Hi, > > I have problems with the performance of FTS in a query like this: > > SELECT * FROM FullTextSearch WHERE content_tsv_gin @@ > plainto_tsquery('english', 'good'); > > It's slow (> 30 sec.) for some GB (27886 html files, originally 73 MB zipped). > The planner obviously always chooses table scan: http://explain.depesz.com/s/EEE > I have to check again, if I'm doing something wrong but I'm pretty > sure it has to do with de-toasting and (wrong?) cost estimations. If you havent done it .. bump up statistics target on the column and re-analyze, see what that gives. I have also been playing with the cost-numbers in order to get it to favour an index-scan more often. That is lowering random_page_cost to be close to seq_page_cost, dependent on your system, the amount of memory, etc, then this can have negative side-effects on non-gin-queries. -- Jesper -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance