Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 7145C4759B2 for ; Sat, 13 Jul 2002 11:28:30 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 02FCED605; Sat, 13 Jul 2002 08:28:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id E8BD15C02; Sat, 13 Jul 2002 08:28:34 -0700 (PDT) Date: Sat, 13 Jul 2002 08:28:34 -0700 (PDT) From: Stephan Szabo To: Julian Scarfe Cc: Subject: Re: Indexes with LIKE In-Reply-To: <000901c22a53$206e0ad0$0500a8c0@Wilbur> Message-ID: <20020713082522.U19431-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200207/202 X-Sequence-Number: 8581 On Sat, 13 Jul 2002, Julian Scarfe wrote: > I've noticed a difference in behaviour between a server running version 6.x > and one running 7.2.1 in use of indexes with LIKE. > > With an index on foo, > > WHERE foo LIKE 'bar%' > > uses the index (as I would expect it to) on the 6.x box, but uses a > sequential scan (really slow) on the 7.2.1 box. > It's possible that I've set (or failed to set) a run-time parameter that > controls the behaviour, but I don't know what that might be. ANALYZEing the > table doesn't modify the behaviour. > > I can't find any mention of this in the documentation -- any pointers would > be appreciated. You need to have made the database in C locale in order to get index scans from LIKE. I think that's mentioned in the Localization section of the admin guide, but I could be remembering that wrong.