On Mon, 21 Jan 2019 at 13:45, Imai, Yoshikazu <imai.yoshik...@jp.fujitsu.com> wrote: > On Wed, Jan 17, 2019 at 10:25 AM, Amit Langote wrote: > > Are you saying that, when using auto mode, all executions of the query > > starting from 7th are slower than the first 5 executions? That is, the > > latency of creating and using a custom plan increases *after* a generic > > plan is created and discarded on the 6th execution of the query? If so, > > that is inexplicable to me. > > Yes. And it's also inexplicable to me. > > I'll check if this fact is really correct by majoring the time of the > first 5 queries before generic plan is created and the other queries > after generic plan is created.
It would be interesting to see the profiles of having the generic plan being built on the 6th execution vs the 400,000th execution. I'd thought maybe one difference would be the relcache hash table having been expanded greatly after the generic plan was created, but I see even the generic plan is selecting a random partition, so the cache would have ended up with that many items eventually anyway, and since we're talking in the odds of 7.8k TPS with 4k partitions, it would have only have taken about 2-3 seconds out of the 60 second run to hit most or all of those partitions anyway. So I doubt it could be that. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services