Re: Re: Optimizing pg_trgm makesign() (was Re: WIP: Fast GiST index build) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Re: Optimizing pg_trgm makesign() (was Re: WIP: Fast GiST index build)
Date
Msg-id 15195.1317330983@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: Optimizing pg_trgm makesign() (was Re: WIP: Fast GiST index build)  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Re: Optimizing pg_trgm makesign() (was Re: WIP: Fast GiST index build)
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Looking at the big picture, however, the real problem with all those 
> makesign() calls is that they happen in the first place. They happen 
> when gist needs to choose which child page to place a new tuple on. It 
> calls the penalty for every item on the internal page, always passing 
> the new key as the 2nd argument, along the lines of:

> for (all items on internal page)
>    penalty(item[i], newitem);

> At every call, gtrgm_penalty() has to calculate the signature for 
> newitem, using makesign(). That's an enormous waste of effort, but 
> there's currently no way gtrgm_penalty() to avoid that.

Hmm.  Are there any other datatypes for which the penalty function has
to duplicate effort?  I'm disinclined to fool with this if pg_trgm is
the only example ... but if it's not, maybe we should do something
about that instead of micro-optimizing makesign.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Re: Optimizing pg_trgm makesign() (was Re: WIP: Fast GiST index build)
Next
From: Tom Lane
Date:
Subject: Re: pg_upgrade - add config directory setting