Re: Postgres not using index on views

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Postgres not using index on views
Дата
Msg-id 26256.1586236149@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Postgres not using index on views  (Justin Pryzby <pryzby@telsasoft.com>)
Ответы RE: Postgres not using index on views  (Rick Vincent <rvincent@temenos.com>)
Список pgsql-performance
Justin Pryzby <pryzby@telsasoft.com> writes:
> On Mon, Apr 06, 2020 at 02:19:59PM +0000, Rick Vincent wrote:
>> The following query takes an extremely long time for only 180 rows, and what this means is that we would have to
indexanything appearing in the where clause for every table in order to use views because the views seem not to
considerthe select clause.  Why is that and does anyone know a way around this? 

> Is there a reason why you don't store the extracted value in its own column ?

The planner seems to be quite well aware that the slower query is going to
be slower, since the estimated costs are much higher.  Since it's not
choosing to optimize into a faster form, I wonder whether it's constrained
by semantic requirements.  In particular, I'm suspicious that some of
those functions you have in the view are marked "volatile", preventing
them from being optimized away.

Beyond that guess, though, there's really not enough info here to say.
The info we usually ask for to debug slow-query problems is explained
at

https://wiki.postgresql.org/wiki/Slow_Query_Questions

            regards, tom lane



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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: Postgres not using index on views
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Postgres not using index on views