Roderick A. Anderson wrote:
>There is a discussion going on on the sql-ledger mailing list concerning
>whether indexes will provide any performance improvements. The one that
>caught my eye was whether using LIKE in a statement would force a
>sequential scan.
>
You can always check exaclty what's being done in your queries by
using the EXPLAIN command. For example, to test your hypothesis:
------------------
test=# create table foo(f text, i int);
CREATE
test=# create index foo_t on foo (f);
CREATE
test=# explain select * from foo where f like '%uiop%';
NOTICE: QUERY PLAN:
Seq Scan on foo (cost=0.00..22.50 rows=1 width=36)
EXPLAIN
test=# explain select * from foo where f = '%uiop%';
NOTICE: QUERY PLAN:
Index Scan using foo_t on foo (cost=0.00..17.07 rows=5 width=36)
EXPLAIN
---------------------
-dj trombley
<dtrom@bumba.net>