Re: STABLE vs. IMMUTABLE w.r.t. indexes

Поиск
Список
Период
Сортировка
От Moshe Jacobson
Тема Re: STABLE vs. IMMUTABLE w.r.t. indexes
Дата
Msg-id CAJ4CxLny28x7WZ8YeF-LDRH3Cz6cG3GzpkVtidpp-xu3wTf1Cw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: STABLE vs. IMMUTABLE w.r.t. indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

On Mon, Nov 3, 2014 at 3:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I'd also like to know why it wouldn't work if the function was STABLE:
> Since Postgres should know that it's not going to change over the course of
> the query, couldn't it substitute the value as well?

You have not shown us the context, but I suspect you are wishing that the
planner would assume that the function's result can't change between
planning and execution.  Unfortunately, it can.

OK. So then I'd like to inform the planner that I don't care if the GUC value changes after the database session has begun. I want it to get the value and substitute it out in the planning phase so that the planner can find and use the correct index.

Is there any way to do this without marking something immutable when it is not?

Thanks.

Moshe Jacobson
Principal Architect, Nead Werx Inc.
2323 Cumberland Parkway · Suite 201 · Atlanta, GA 30339

"Quality is not an act, it is a habit." -- Aristotle

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

Предыдущее
От: hari.fuchs@gmail.com
Дата:
Сообщение: Re: Help with PostgreSQL 9.4 to expand jsonb int array into table with row numbers
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Is any information about trigger-name and src-table available at the protocol-level?