Skip site navigation (1) Skip section navigation (2)

SQL optimization - WHERE SomeField STARTING WITH ...

From: Bill <pg(at)dbginc(dot)com>
To: PgSQL General <pgsql-general(at)postgresql(dot)org>
Subject: SQL optimization - WHERE SomeField STARTING WITH ...
Date: 2008-08-28 18:10:47
Message-ID: 48B6EA27.30503@dbginc.com (view raw or flat)
Thread:
Lists: pgsql-general
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?

Bill

Responses

pgsql-general by date

Next:From: Tom LaneDate: 2008-08-28 18:23:10
Subject: Re: temp schemas
Previous:From: Tom LaneDate: 2008-08-28 18:08:18
Subject: Re: strange explain analyze output

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group