Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 50E7F2E00C9 for ; Thu, 21 Feb 2008 18:59:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 96399-06 for ; Thu, 21 Feb 2008 18:59:10 -0400 (AST) Received: from smtp3.clear.net.nz (smtp3.clear.net.nz [203.97.33.64]) by postgresql.org (Postfix) with ESMTP id 350DC2E00D6 for ; Thu, 21 Feb 2008 18:59:16 -0400 (AST) Received: from zmori.markir.net (121-72-73-8.dsl.telstraclear.net [121.72.73.8]) by smtp3.clear.net.nz (CLEAR Net Mail) with ESMTP id <0JWM005O42INOO10@smtp3.clear.net.nz> for pgsql-performance@postgresql.org; Fri, 22 Feb 2008 11:59:13 +1300 (NZDT) Date: Fri, 22 Feb 2008 11:59:06 +1300 From: Mark Kirkwood Subject: Re: 4s query want to run faster In-reply-to: <8a5d3c890802211323j2a7e2ebdye42f988222046e44@mail.gmail.com> To: Adonias Malosso Cc: Claus Guttesen , pgsql-performance@postgresql.org Message-id: <47BE023A.6000905@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <8a5d3c890802211248k7d9dfbb5ndd645358a84130a7@mail.gmail.com> <8a5d3c890802211311m5fab66d6q865fda1737e47802@mail.gmail.com> <8a5d3c890802211323j2a7e2ebdye42f988222046e44@mail.gmail.com> User-Agent: Thunderbird 2.0.0.9 (X11/20071203) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/278 X-Sequence-Number: 28820 The other parameter you might want to look at is effective_cache_size - increasing it will encourage index use. On a machine with 16GB the default is probably too small (there are various recommendations about how to set this ISTR either Scott M or Greg Smith had a page somewhere that covered this quite well - guys?). Obviously, decreasing random_page_cost fixed this query for you, but if find yourself needing to tweak it again for other queries, then look at changing effective_cache_size. Cheers Mark Adonias Malosso wrote: > Set random_page_cost = 2 solved the problem. thanks >