Re: sequential scans and the like operator

From: Dave Trombley <dtrom(at)bumba(dot)net>
To: "Roderick A(dot) Anderson" <raanders(at)tincan(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: sequential scans and the like operator
Date: 2002-01-08 19:05:54
Message-ID: 3C3B4312.5020805@bumba.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)bumba(dot)net>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message SHELTON,MICHAEL (Non-HP-Boise,ex1) 2002-01-08 19:25:12 Re: How to Install PostgreSQL on Windows 2000
Previous Message Dave Trombley 2002-01-08 19:01:51 Re: JDO implementation?