On Wed, 26 May 2021 at 14:19, Andy Fan <zhihui.fan1...@gmail.com> wrote: > I just checked the latest code, looks like we didn't improve this situation > except > that we introduced a GUC to control it. Am I missing something? I don't > have a > suggestion though.
Various extra caching was done to help speed it up. We now cache the volatility of RestrictInfo and PathTarget. I also added caching for the hash function in RestrictInfo so that we could more quickly determine if we can Result Cache or not. There's still a bit of caching left that I didn't do. This is around lateral_vars. I've nowhere to cache the hash function since that's just a list of vars. At the moment we need to check that each time we consider a result cache path. LATERAL joins are a bit less common so I didn't think that would be a huge issue. There's always enable_resultcache = off for people who cannot tolerate the overhead. Also, it's never going to be 100% as fast as it was. We're considering another path that we didn't consider before. Did you do some performance testing that caused you to bring this topic up? David