| From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
|---|---|
| To: | Bill <pg(at)dbginc(dot)com> |
| Cc: | "PgSQL General" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: SQL optimization - WHERE SomeField STARTING WITH ... |
| Date: | 2008-08-28 18:40:37 |
| Message-ID: | 162867790808281140u3bf99fe1qd0d46abe757064e0@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hello
2008/8/28 Bill <pg(at)dbginc(dot)com>:
> The SQL database servers I have worked with cannot use and index for a
> SELECT of the form
>
> SELECT * FROM ATABLE
> WHERE AFIELD LIKE ?
>
> because there is no way to know the location of the wild card until the
> parameter value is known. InterBase and Firebird allow
>
> SELECT * FROM ATABLE
> WHERE AFIELD STARTING WITH ?
>
> which is equivalent to LIKE 'ABC%' and will use an index on AFIELD. Is
> there a similar syntax in PostgreSQL?
>
there is some similar - look
http://www.depesz.com/index.php/2008/03/04/searching-for-longest-prefix/
http://pgfoundry.org/projects/prefix
regards
Pavel Stehule
> Bill
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Marlowe | 2008-08-28 19:06:55 | Re: importing dates |
| Previous Message | Tom Lane | 2008-08-28 18:23:10 | Re: temp schemas |