Re: How does Index Scan get used

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Samuel J(dot) Sutjiono" <ssutjiono(at)wc-group(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How does Index Scan get used
Date: 2002-02-22 17:58:27
Message-ID: 17992.1014400707@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Samuel J. Sutjiono" <ssutjiono(at)wc-group(dot)com> writes:
> create table test (test_col text);
> create index test_index on test (test_col);
> insert into test values ('abc.xyz');
> insert into test values ('abcxyz');
> insert into test values ('abc/xyz');

> explain select * from test where test_col like 'abc/%';

> NOTICE: QUERY PLAN:

> Seq Scan on test (cost=3D0.00..22.50 rows=3D10 width=3D12)

I did the above and got:

regression=# explain select * from test where test_col like 'abc/%';
NOTICE: QUERY PLAN:

Index Scan using test_index on test (cost=0.00..17.07 rows=5 width=32)

Perhaps you are using a locale that prevents LIKE from being optimized
into an indexscan? See
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/charset.html#AEN16601

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-02-22 18:02:19 Re: Does iscachable work?
Previous Message tony 2002-02-22 17:51:26 moving to 7.2