X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 792BF3A514B for ; Mon, 29 Nov 2004 13:45:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30415-03 for ; Mon, 29 Nov 2004 13:45:36 +0000 (GMT) Received: from guppy.vub.ac.be (ipmb.vub.ac.be [134.184.129.2]) by svr1.postgresql.org (Postfix) with ESMTP id 93D463A5124 for ; Mon, 29 Nov 2004 13:45:36 +0000 (GMT) Received: from mach.vub.ac.be (mach.vub.ac.be [134.184.129.8]) by guppy.vub.ac.be (8.9.1b+Sun/3.17.1.ap (guppy)) id OAA20703; Mon, 29 Nov 2004 14:45:35 +0100 (MET) for Received: from olivier.amaze.ulb.ac.be (ucmbsgi10.ulb.ac.be [164.15.109.34]) by mach.vub.ac.be (Postfix) with ESMTP id E848D26A2 for ; Mon, 29 Nov 2004 14:45:34 +0100 (CET) To: pgsql-sql@postgresql.org Subject: Re: INDEX and LIKE References: <41AB13C0.40909@numerixtechnology.de> Message-ID: Date: Mon, 29 Nov 2004 14:45:42 +0100 From: "Olivier Hubaut" Organization: aMAZE Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <41AB13C0.40909@numerixtechnology.de> User-Agent: Opera M2/7.54 (MacPPC, build 1840) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/285 X-Sequence-Number: 19603 On Mon, 29 Nov 2004 12:19:12 +0000, T E Schmitz wrote: > Hello, > > I need to be able to perform wildcard searches on a VARCHAR(100) column > of the form > > SELECT * FROM item WHERE serial_no LIKE '%12345678%' > > Would an index on serial_no do anything at all for this search? > No, It wouldn't. If you use "%" for the beginning of you search pattern, a seqential search is performed, ignoring the index wich use the beginning of the string in order to create it's B-tree. -- Downloading signature ... 99% *CRC FAILED* signature aborted