trivial like clauses and indexes question

Поиск
Список
Период
Сортировка
От jens
Тема trivial like clauses and indexes question
Дата
Msg-id 43569E50.5070808@transversal.com
обсуждение исходный текст
Список pgsql-novice
Hello,

I'm trying to do a simple select with a like clause,

explain select * from test where name like '_100_100_100%';
                       QUERY PLAN
-------------------------------------------------------
  Seq Scan on test  (cost=0.00..589.54 rows=1 width=68)
    Filter: ((name)::text ~~ '_100_100_100%'::text)

but it's not using any key though

explain select * from test where name = '_100_100_100';
                                QUERY PLAN
-------------------------------------------------------------------------
  Index Scan using idx_nrm on test  (cost=0.00..360.11 rows=104 width=68)
    Index Cond: ((name)::text = '_100_100_100'::text)

is and my keys are defined as

              Table "public.test"
  Column |          Type          | Modifiers
--------+------------------------+-----------
  name   | character varying(100) |
Indexes:
     "idx" btree (name varchar_pattern_ops)
     "idx_nrm" btree (name)

What's the problem here? My locale isn't C, if this makes some difference.

Thanks for any help,

Jens


В списке pgsql-novice по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Displaying current query - eliminating
Следующее
От: Benjamin Power
Дата:
Сообщение: Postgresql installation - Cannot add postgres user (already in use)