X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 144C99DC9C7 for ; Tue, 21 Feb 2006 11:57:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95886-05 for ; Tue, 21 Feb 2006 11:57:20 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.206]) by postgresql.org (Postfix) with ESMTP id 93F379DC9A7 for ; Tue, 21 Feb 2006 11:57:13 -0400 (AST) Received: by zproxy.gmail.com with SMTP id r28so1264060nza for ; Tue, 21 Feb 2006 07:57:15 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=lbap1k8dXPtXrRCtILlpu2h9Vp1Tp3yM2C59WtOLdzjDBmYn2kvZboBhqwAkp3/eMDEcWpsi/ZsnfU4FWnKC7Tg8hqu0oXzXhH0w7XiIy2EYJueHVqRl3UTJ07jqqB6q3egywqrZbNI+Dha7haxWdGAsWmSe0gBHiYDFCQWVWKU= Received: by 10.36.43.6 with SMTP id q6mr7220970nzq; Tue, 21 Feb 2006 07:57:12 -0800 (PST) Received: by 10.36.106.12 with HTTP; Tue, 21 Feb 2006 07:57:12 -0800 (PST) Message-ID: Date: Tue, 21 Feb 2006 17:57:12 +0200 From: "Ibrahim Tekin" To: pgsql-performance@postgresql.org Subject: LIKE query on indexes MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_22470_31490145.1140537432544" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.76 required=5 tests=[AWL=0.116, HTML_00_10=0.642, HTML_MESSAGE=0.001] X-Spam-Score: 0.76 X-Spam-Level: X-Archive-Number: 200602/327 X-Sequence-Number: 17313 ------=_Part_22470_31490145.1140537432544 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline hi, i have btree index on a text type field. i want see rows which starts with certain characters on that field. so i write a query like this: SELECT * FROM mytable WHERE myfield LIKE 'john%' since this condition is from start of the field, query planner should use index to find such elements but explain command shows me it will do a sequential scan. is this lack of a feature or i am wrong somewhere? ------=_Part_22470_31490145.1140537432544 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline hi,
i have btree index on a text type field. i want see rows which start= s with certain characters on that field. so i write a query like this:
<= br>SELECT * FROM mytable WHERE myfield LIKE 'john%'

since this condi= tion is from start of the field, query planner should use index to find suc= h elements but explain command shows me it will do a sequential scan.

is this lack of a feature or i am wrong somewhere?
------=_Part_22470_31490145.1140537432544--