Re: select like and indexes

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: "William N(dot) Zanatta" <william(at)veritel(dot)com(dot)br>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: select like and indexes
Date: 2003-01-20 19:56:19
Message-ID: 20030120115421.S68170-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> I'm quite new to postgresql. I need some help to understand some of
> 'how it works'.
>
> I have a table with aprox. 1 million tuples (row == tuple ??) and
> I've created an index on a column 'ip' in my table.
>
> Well the question is: when I do,
>
> explain analyze select * from tbl_xxxx where ip like '200%';
>
> why PG doesn't use Index Scan method? why does it uses sequential
> scan in place?

If you aren't in the "C" locale, you won't get index scans on like
queries at all. Recent initdbs should warn you of this.

The problem is that the conversion of the above into the currently used
indexable form (something like ip>='200' and ip<'201') doesn't necessarily
work in every locale. There's been talk at various times about this, but
I don't think anything was decided.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message William N. Zanatta 2003-01-20 19:59:14 Help on query plan. (was: select like and indexes)
Previous Message Michael Meskes 2003-01-20 19:38:18 Re: Altering a table - positioning new columns