Re: [HACKERS] Surjective functional indexes - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [HACKERS] Surjective functional indexes
Date
Msg-id 20170525170715.hhptla6ks3bjxqxc@alap3.anarazel.de
Whole thread Raw
In response to Re: [HACKERS] Surjective functional indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2017-05-25 12:37:40 -0400, Tom Lane wrote:
> Konstantin Knizhnik <k.knizhnik@postgrespro.ru> writes:
> > My proposal is to check value of function for functional indexes instead 
> > of just comparing set of effected attributes.
> > Obviously, for some complex functions it may  have negative effect on 
> > update speed.
> > This is why I have added "surjective" option to index.
> 
> This seems overcomplicated.  We would have to compute the function
> value at some point anyway.  Can't we refactor to do that earlier?

Yea, that'd be good. Especially if we were to compute the expressions
for all indexes in one go - doing that in other places (e.g. aggregate
transition values) yielded a good amount of speedup.  It'd be even
larger if we get JITing of expressions.  It seems feasible to do so for
at least the nodeModifyTable case.

I wonder if there's a chance to use such logic alsofor HOT update
considerations, but that seems harder to do without larger layering
violations.

- Andres



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] CREATE STATISTICS statistic_type documentation
Next
From: Konstantin Knizhnik
Date:
Subject: Re: [HACKERS] Surjective functional indexes