Re: How does Index Scan get used

From: "Samuel J(dot) Sutjiono" <ssutjiono(at)wc-group(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: How does Index Scan get used
Date: 2002-03-21 02:15:06
Message-ID: 026201c1d07e$387d7f90$110a010a@headquarters.wcgroup.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom,

I still haven't been able to use index scan on my LIKE query.

- I am using BTREE index. Am I supposed to use RTREE for LIKE to use index ?
- I am not using a locale.

Please let me know what other settings(parameters) that I need to check to
make the query optimizer use Index Scan.
I would really appreciate your help.

Best Regards,
Sam

----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Samuel J. Sutjiono" <ssutjiono(at)wc-group(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Friday, February 22, 2002 12:58 PM
Subject: Re: [GENERAL] How does Index Scan get used

> "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#AEN
16601
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2002-03-21 02:31:55 Re: mysql migration
Previous Message Rob Storrs 2002-03-21 01:32:38 Re: Visual display tool?