Re: Caching query plan costs

2018-09-03 Thread Bruce Momjian
On Mon, Sep 3, 2018 at 04:13:40PM -0700, Andres Freund wrote: > On September 3, 2018 3:01:29 PM PDT, Bruce Momjian > wrote: > >On Mon, Sep 3, 2018 at 02:53:59PM -0700, Andres Freund wrote: > >> On 2018-09-03 14:56:28 -0400, Bruce Momjian wrote: > >> > On Mon, Sep 3, 2018 at 11:42:31AM -0700, Andre

Re: Caching query plan costs

2018-09-03 Thread Andres Freund
On September 3, 2018 3:01:29 PM PDT, Bruce Momjian wrote: >On Mon, Sep 3, 2018 at 02:53:59PM -0700, Andres Freund wrote: >> On 2018-09-03 14:56:28 -0400, Bruce Momjian wrote: >> > On Mon, Sep 3, 2018 at 11:42:31AM -0700, Andres Freund wrote: >> > > > and JIT, so it doesn't have to be 100% acc

Re: Caching query plan costs

2018-09-03 Thread Bruce Momjian
On Mon, Sep 3, 2018 at 02:53:59PM -0700, Andres Freund wrote: > On 2018-09-03 14:56:28 -0400, Bruce Momjian wrote: > > On Mon, Sep 3, 2018 at 11:42:31AM -0700, Andres Freund wrote: > > > > and JIT, so it doesn't have to be 100% accurate. > > > > > > JIT decision is done after main planning, so we

Re: Caching query plan costs

2018-09-03 Thread Andres Freund
On 2018-09-03 14:56:28 -0400, Bruce Momjian wrote: > On Mon, Sep 3, 2018 at 11:42:31AM -0700, Andres Freund wrote: > > > and JIT, so it doesn't have to be 100% accurate. > > > > JIT decision is done after main planning, so we know the cost. > > Well, as I remember, we are considering disabling JI

Re: Caching query plan costs

2018-09-03 Thread Tomas Vondra
On 09/03/2018 08:56 PM, Bruce Momjian wrote: > On Mon, Sep 3, 2018 at 11:42:31AM -0700, Andres Freund wrote: >> On September 3, 2018 11:33:35 AM PDT, Bruce Momjian >> wrote: >>> On Mon, Sep 3, 2018 at 01:30:33PM -0400, Tom Lane wrote: Bruce Momjian writes: > What if we globally or locall

Re: Caching query plan costs

2018-09-03 Thread Bruce Momjian
On Mon, Sep 3, 2018 at 11:42:31AM -0700, Andres Freund wrote: > On September 3, 2018 11:33:35 AM PDT, Bruce Momjian > wrote: > >On Mon, Sep 3, 2018 at 01:30:33PM -0400, Tom Lane wrote: > >> Bruce Momjian writes: > >> > What if we globally or locally cache the _cost_ of plans, so we > >> > can con

Re: Caching query plan costs

2018-09-03 Thread Andres Freund
On September 3, 2018 11:33:35 AM PDT, Bruce Momjian wrote: >On Mon, Sep 3, 2018 at 01:30:33PM -0400, Tom Lane wrote: >> Bruce Momjian writes: >> > What if we globally or locally cache the _cost_ of plans, so we can >> > consult that cache before planning and enable certain >optimizations? >>

Re: Caching query plan costs

2018-09-03 Thread Bruce Momjian
On Mon, Sep 3, 2018 at 01:30:33PM -0400, Tom Lane wrote: > Bruce Momjian writes: > > What if we globally or locally cache the _cost_ of plans, so we can > > consult that cache before planning and enable certain optimizations? > > But what would you use as cache key? And how's this help if we ha

Re: Caching query plan costs

2018-09-03 Thread Tom Lane
Bruce Momjian writes: > What if we globally or locally cache the _cost_ of plans, so we can > consult that cache before planning and enable certain optimizations? But what would you use as cache key? And how's this help if we haven't seen a similar query before in the session?