X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 88CD3D1B4B7 for ; Fri, 19 Dec 2003 03:31:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 20768-06 for ; Thu, 18 Dec 2003 23:30:36 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 7B31AD1B45A for ; Thu, 18 Dec 2003 23:30:32 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hBJ3UVU6081650 for ; Fri, 19 Dec 2003 03:30:32 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hBJ3SVB1078996 for pgsql-performance@postgresql.org; Fri, 19 Dec 2003 03:28:31 GMT From: Christopher Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: is it possible to get the optimizer to use indexes with a like clause Date: Thu, 18 Dec 2003 22:22:38 -0500 Organization: cbbrowne Computing Inc Lines: 21 Message-ID: References: <3FE1F5A1.6080908@geizhals.at> <60n09q9bqg.fsf@dev6.int.libertyrms.info> <1071789528.1629.10.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux) Cancel-Lock: sha1:Q3cISRgx/BUPdg4/ElO3oOiwRiA= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/270 X-Sequence-Number: 5130 pg@fastcrypt.com (Dave Cramer) wrote: > It appears that the optimizer only uses indexes for = clause? It can use indices only if there is a given prefix. Thus: where text_field like 'A%' can use the index, essentially transforming this into the clauses where text_field >= 'A' and text_field < 'B'. You can't get much out of an index for where text_field like '%SOMETHING' -- (reverse (concatenate 'string "moc.enworbbc" "@" "enworbbc")) http://www3.sympatico.ca/cbbrowne/wp.html "When the grammar checker identifies an error, it suggests a correction and can even makes some changes for you." -- Microsoft Word for Windows 2.0 User's Guide, p.35: