Re: How to make LIKE to use index in "abc%" query?

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: pgsql-general(at)postgresql(dot)org, dmitry(at)koterov(dot)ru
Subject: Re: How to make LIKE to use index in "abc%" query?
Date: 2007-10-08 16:52:16
Message-ID: 200710081852.19057.dfontaine@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le lundi 08 octobre 2007, Dmitry Koterov a écrit :
> explain analyze
> SELECT id FROM "table" WHERE name LIKE 'dt%';
>
> having a btree index on "name" column. But unfortunately it uses seqscan
> instead of index scan, it's too slow.

It seems to me you'd benefit from reading this page of the fine manual:
http://www.postgresql.org/docs/current/interactive/indexes-opclass.html

Regards,
--
dim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Bartlett 2007-10-08 17:05:50 Re: Request: Anyone using bogus / "humorous" X-Message-Flag headers, could we please turn them off
Previous Message Dmitry Koterov 2007-10-08 16:41:54 How to make LIKE to use index in "abc%" query?