Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1471C9FB395 for ; Thu, 7 Jun 2007 00:35:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 31590-04 for ; Thu, 7 Jun 2007 00:34:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 89B9C9FB38E for ; Thu, 7 Jun 2007 00:34:59 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mark.mielke.cc (206-248-136-41.dsl.teksavvy.com [206.248.136.41]) by svr4.postgresql.org (Postfix) with ESMTP id 4E43E5AF02D for ; Thu, 7 Jun 2007 03:34:58 +0000 (GMT) Received: from mark.mielke.cc (localhost.localdomain [127.0.0.1]) by mark.mielke.cc (8.14.1/8.14.1) with ESMTP id l573XtCS002790; Wed, 6 Jun 2007 23:33:55 -0400 Received: (from mark@localhost) by mark.mielke.cc (8.14.1/8.14.1/Submit) id l573XqdC002789; Wed, 6 Jun 2007 23:33:52 -0400 Date: Wed, 6 Jun 2007 23:33:52 -0400 From: mark@mark.mielke.cc To: James Mansion Cc: Mark Lewis , Magnus Hagander , Alexander Staubo , Andy , pgsql-performance@postgresql.org Subject: Re: LIKE search and performance Message-ID: <20070607033352.GA2773@mark.mielke.cc> References: <009501c79d4c$445428f0$0b00a8c0@mpsro.dom> <88daf38c0705230905u1a981102k691b47bd36011a80@mail.gmail.com> <4655DE75.4080506@mansionfamily.plus.com> <4655E64B.5050503@hagander.net> <4655FB8A.1040707@mansionfamily.plus.com> <1180040560.31471.262.camel@archimedes> <20070524215450.GA3858@mark.mielke.cc> <466733D1.1040308@mansionfamily.plus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <466733D1.1040308@mansionfamily.plus.com> User-Agent: Mutt/1.5.14 (2007-02-12) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.86 tagged_above=0 required=5 tests=AWL=-0.237, BAYES_50=0.001, FORGED_RCVD_HELO=0.135, NO_REAL_NAME=0.961 X-Spam-Level: X-Archive-Number: 200706/117 X-Sequence-Number: 25150 On Wed, Jun 06, 2007 at 11:23:13PM +0100, James Mansion wrote: > mark@mark.mielke.cc wrote: > >What is a real life example where an intelligent and researched > >database application would issue a like or ilike query as their > >primary condition in a situation where they expected very high > >selectivity? > In my case the canonical example is to search against textual keys > where the search is performed automatically if the user hs typed > enough data and paused. In almost all cases the '%' trails, and I'm > looking for 'starts with' in effect. usually the search will have a > specified upper number of returned rows, if that's an available > facility. I realise in this case that matching against the index > does not allow the match count unless we check MVCC as we go, but I > don't see why another thread can't be doing that. I believe PostgreSQL already considers using the index for "starts with", so this wasn't part of the discussion for me. Sorry that this wasn't clear. Cheers, mark -- mark@mielke.cc / markm@ncf.ca / markm@nortel.com __________________________ . . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder |\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | | | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada One ring to rule them all, one ring to find them, one ring to bring them all and in the darkness bind them... http://mark.mielke.cc/