planning issue

Поиск
Список
Период
Сортировка
От Jonathan Vanasco
Тема planning issue
Дата
Msg-id C32FB1DA-F767-49A6-BC7F-6D0474B9E6B8@2xlp.com
обсуждение исходный текст
Ответы Re: planning issue  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: planning issue  (Alban Hertroys <alban@magproductions.nl>)
Список pgsql-general
if you have time, could you offer advice on this:

i'm doing a database cleanup right now -- 1.4M records -- and each
query is taking 1 second

i can't really wait 2 weeks for this to finish , so I'm hoping that
someone will be able to help out

the issue is that the planner keeps doing a sequential scan, despite
the fact that the requesite columns are indexed.

hoping someone may be able to offer advice:.

SELECT
    *
FROM
    table_a
WHERE
    id != 10001
    AND
    (
            (  field_1 ilike '123' )
            OR
            ( field_2 ilike 'abc' )
    )



         QUERY PLAN
------------------------------------------------------------------------
------------------------------------------------------------------------
-------------------------
Seq Scan on table_a  (cost=0.00..22779.68 rows=1 width=346)
    Filter: ((id <> 10001) AND (((field_1)::text ~~* '123'::text) OR
((field_2)::text ~~* 'abc'::text)))


however, i have the following indexes:

     "table_a__pkey" PRIMARY KEY, btree (id)
     "table_a__idx__field_1" btree (field_1)
     "table_a__idx__field_2" btree (field_2)

can anyone offer advice to help me use the indexes on this ?


// Jonathan Vanasco

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

Предыдущее
От: "Bruce McAlister"
Дата:
Сообщение: Re: PostgreSQL 8.2.3 VACUUM Timings/Performance
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: planning issue