plpgsql plan cache

Поиск
Список
Период
Сортировка
От Joel Jacobson
Тема plpgsql plan cache
Дата
Msg-id 38E2265E-B38E-4EBD-BB87-23B46EF4FD1C@gluefinance.com
обсуждение исходный текст
Ответы Re: plpgsql plan cache  ("Pierre C" <lists@peufeu.com>)
Список pgsql-performance
Hi,

I am trying to make a select query in my plpgsql function to use an
index allowing an index scan instead of a seq scan.

When running the query in the sql prompt,  it works fine, but
apparently the index is not used for the same query in the plpgsql
function.

The problem is not the data types of the parameters to the function or
the query, they are identical.

When I tried using EXECUTE in the plpgsql function, the index is being
used.

I thought the query planner must have made a bad decision when I
created the function the first time.

I therefore tried to drop the function, disconnect from the sql
client, reconnect (to get a new session), create the function again.
The function still runs slow though.

I cannot understand why the index is not being used when in the
plpgsql function?
I even tried to make a test function containing nothing more than the
single query. Still the index is not being used.
When running the same query in the sql prompt, the index is in use
though.

Is there a way to someone clear the entire query cache or even better
for a particular plpgsql function?

I'm greatful for any ideas.

Best regards,

Joel Jacobson


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

Предыдущее
От: Ron Mayer
Дата:
Сообщение: Re: SSD + RAID
Следующее
От: "Pierre C"
Дата:
Сообщение: Re: plpgsql plan cache