Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id BB99D9FB409 for ; Wed, 4 Oct 2006 06:50:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 09377-07 for ; Wed, 4 Oct 2006 09:50:41 +0000 (UTC) X-Greylist: delayed 00:16:49.79172 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 3F1D29FB1FF for ; Wed, 4 Oct 2006 06:50:41 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr4.postgresql.org (Postfix) with ESMTP id 491255AF895 for ; Wed, 4 Oct 2006 09:33:48 +0000 (GMT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 0511274484; Wed, 4 Oct 2006 10:33:40 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 8A51115EA3; Wed, 4 Oct 2006 10:33:40 +0100 (BST) Message-ID: <45238085.3000407@archonet.com> Date: Wed, 04 Oct 2006 10:36:05 +0100 From: Richard Huxton User-Agent: Thunderbird 1.5.0.7 (X11/20060909) MIME-Version: 1.0 To: simon godden Cc: Heikki Linnakangas , pgsql-performance@postgresql.org Subject: Re: simple case using index on windows but not on linux References: <168519350610040048m7c4031e3t1a24b3fd4d9265a3@mail.gmail.com> <45237AD0.50604@enterprisedb.com> <168519350610040219n648a282hf159ff272e0f672a@mail.gmail.com> In-Reply-To: <168519350610040219n648a282hf159ff272e0f672a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/77 X-Sequence-Number: 21206 simon godden wrote: > (Sending again because I forgot to reply to all) > > On 10/4/06, Heikki Linnakangas wrote: >> You can increase the max shared memory size if you have root access. See >> >> http://www.postgresql.org/docs/8.1/interactive/kernel-resources.html#SYSVIPC-PARAMETERS >> >> >> Scroll down for Linux-specific instructions. > > Thanks for the link. > > Are you saying that the shared memory size is the issue here? Please > can you explain how it would cause a seq scan rather than an index > scan. > > I would like to understand the issue before making changes. It *might* be shared-memory settings. It's almost certainly something to do with setup. If you have the same data and the same query and can reliably produce different results then something else must be different. If you look at the explain output from both, PG knows the seq-scan is going to be expensive (cost=20835) so the Linux box either 1. Doesn't have the index (and you say it does, so it's not this). 2. Thinks the index will be even more expensive. 3. Can't use the index at all. Issue "set enable_seqscan=false" and then run your explain analyse. If your query uses the index, what is the estimated cost? If the estimated cost is larger than a seq-scan that would indicate your configuration settings are badly out-of-range. If the index isn't used, then we have problem #3. I think this is what you are actually seeing. Your locale is something other than "C" and PG doesn't know how to use like with indexes. Read up on operator classes or change your locale. http://www.postgresql.org/docs/8.1/static/indexes-opclass.html -- Richard Huxton Archonet Ltd