Re: Query planner issue

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Query planner issue
Дата
Msg-id 48D38005.3010204@archonet.com
обсуждение исходный текст
Ответ на Query planner issue  (Andrea Moretto <moretto.andrea@gmail.com>)
Ответы Re: Query planner issue  (Andrea Moretto <moretto.andrea@gmail.com>)
Список pgsql-general
Andrea Moretto wrote:
> I've got a table called DETAILS, the primary key is : DE_ID char(12),
> there is another field CO_ID char (12).

> If I run "explain analyze select * from details where co_id || co_id =
> '0100760153722324445';" it runs a sequential scan not using the index
> (which takes about 1000000 times than using the index):

That query can never return any rows. You're appending co_id to itself
then testing against a non-repeating string. Furthermore it's 19 chars
long rather than 24. Is this really what you're trying to do?

Read up on "indexes on expressions" in chapter 11 of the manuals, for
indexing this sort of thing. I don't think it will help you here though.

--
  Richard Huxton
  Archonet Ltd

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

Предыдущее
От: Andrea Moretto
Дата:
Сообщение: Query planner issue
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Stop trigger fireing for a specific user?