=?UTF-8?Q?Darafei_=22Kom=D1=8Fpa=22_Praliaskouski?= <m...@komzpa.net> writes: > I'm looking at PostGIS geometry GiST index build times and try to optimize > withing the current GiST framework. The function that shows a lot on my > flame graphs is penalty.
> I spent weekend rewriting PostGIS penalty to be as fast as possible. > (FYI https://github.com/postgis/postgis/pull/425/files) > However I cannot get any meaningfully faster build time. Even when I strip > it to "just return edge extension" index build time is the same. TBH this makes me wonder whether the real problem isn't so much "penalty function is too slow" as "penalty function is resulting in really bad index splits". It might be that giving the opclass higher-level control over the split decision can help with both aspects. But never start micro-optimizing an algorithm until you're sure it's the right algorithm. regards, tom lane