Re: Index only scans for expressional indices when querying for the expression

Поиск
Список
Период
Сортировка
От Danny Shemesh
Тема Re: Index only scans for expressional indices when querying for the expression
Дата
Msg-id CAFZC=QoF9s7ux8XmcxwMYre+B7sq4Am-8xEiqgjfgztBftDg=Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Index only scans for expressional indices when querying for the expression  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Index only scans for expressional indices when querying for the expression  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
A-ha, interesting !

I think we have some specific use cases where it'd be worth the overhead, I'd need to measure it, though; 

Do you think there'd be room to accept a contribution for such functionality with a disabled-by-default pg setting,
or are you skeptical it would ever be worth the trade-off ?

Thanks again,
Danny

On Thu, Aug 4, 2022 at 4:38 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Danny Shemesh <dany74q@gmail.com> writes:
> That is of course correct, but what I mean is that, I think that if one
> would explicitly query f(x), and never for x directly, it would've been
> theoretically possible to say that the index is covering for every f(x),
> wouldn't it ?

Theoretically, yeah, but we don't support that: an index-only scan
will only be considered if x itself is available from the index.
There are a couple of reasons for that, but the main one is that
detecting whether an index matches the query would be far more expensive
if it had to consider expression subtrees not just the base Vars.

                        regards, tom lane

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

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Allow user to connect to replicas only
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Index only scans for expressional indices when querying for the expression