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

2022-08-04 Thread Tom Lane
Danny Shemesh writes: > 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 ? If you can show me a matching algorithm with non-exponential runtime, I'd be interested.

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

2022-08-04 Thread Danny Shemesh
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-o

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

2022-08-04 Thread Tom Lane
Danny Shemesh 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 su

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

2022-08-04 Thread Danny Shemesh
Hey David - thanks for the prompt response ! 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 ? Or in other words, if

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

2022-08-04 Thread David G. Johnston
On Thursday, August 4, 2022, Danny Shemesh wrote: > > I believe the expressional index in itself could've been considered as > covering, when querying for the expression explicitly. > This belief is wrong. When storing f(x) there is no way to recover the value of x. David J.

Index only scans for expressional indices when querying for the expression

2022-08-04 Thread Danny Shemesh
Hello everyone, Quick question here about index-only scans and expressional indices, tested on postgres <= 14, Say I have a column, and an expressional index on said column (fiddle ) - e.g. create table t1 (x text); create index idx_upper o