Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 800D063303C for ; Mon, 23 Feb 2009 10:53:45 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 18859-08 for ; Mon, 23 Feb 2009 10:53:42 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.30]) by mail.postgresql.org (Postfix) with ESMTP id C9C91632214 for ; Mon, 23 Feb 2009 10:53:42 -0400 (AST) Received: by yx-out-2324.google.com with SMTP id 3so752864yxj.73 for ; Mon, 23 Feb 2009 06:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=J/dEk1svSfNtVWlTQ+kLf+zgoUlbimnrRBYrN5CZQ00=; b=Ci85B0Ax0Eny9SNzEYNt2abefg/LbIhMfqzTjFqIswaKDr5qtyf5uGzyrUPWQscnRM dvYNrwyAMrFBQVKsVPSUWd2f5TkRf1GGTG+/wP3zWurpjgKOK+fEVg6hwXdnApABIobs LL+VoirIieHkjlecRmCHzqT+eGydTY44vDJJA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=li4qBUfsU+z2Aq/Or4lBNLN1A66MQxXfDxyh08Wp+8DdjpiSF6wM6YEpHGK0emksOx DDRjv+egplYIzqX8bkyn62etrjCbiTPGljOz8RlO9e0SRmgrjEQwLk80RCiOFqIesOJq JYR3Fk7Ln3tvREgB1amzMSBl+O0/cMJAM0bOQ= MIME-Version: 1.0 Received: by 10.151.106.4 with SMTP id i4mr1103036ybm.99.1235400821198; Mon, 23 Feb 2009 06:53:41 -0800 (PST) In-Reply-To: <49A295F0.5010405@saparev.com> References: <49A295F0.5010405@saparev.com> Date: Mon, 23 Feb 2009 09:53:41 -0500 Message-ID: <603c8f070902230653v346f5b5cm6aeceedce7903f5@mail.gmail.com> Subject: Re: LIMIT confuses the planner From: Robert Haas To: kouber@saparev.com Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/264 X-Sequence-Number: 32845 On Mon, Feb 23, 2009 at 7:26 AM, Kouber Saparev wrote: > Now, recently I have altered some of the default parameters in order to get > as much as possible out of the hardware - 12 GB of RAM, 8 processors. So, I > guess I have done something wrong, thus the planner is taking that wrong > decision. Here's what I have changed in postgresql.conf (from the default > one): > > max_connections = 200 > shared_buffers = 256MB > work_mem = 64MB > maintenance_work_mem = 128MB > max_stack_depth = 6MB > max_fsm_pages = 100000 > synchronous_commit = off > wal_buffers = 1MB > commit_delay = 100 > commit_siblings = 5 > checkpoint_segments = 10 > checkpoint_timeout = 10min > random_page_cost = 0.1 > effective_cache_size = 2048MB > > Any idea what's wrong here? If you left seq_page_cost (which isn't mentioned here) at the default value but reduced random_page_cost to 0.1, then you have random_page_cost < seq_page_cost. That's probably Bad. ...Robert