Re: Partition prune with stable Expr

2020-10-15 Thread Andy Fan
On Mon, Sep 28, 2020 at 8:21 PM Andy Fan wrote: > > > On Mon, Sep 28, 2020 at 7:15 AM Tom Lane wrote: > >> Andy Fan writes: >> > On Mon, Sep 28, 2020 at 4:46 AM David Rowley >> wrote: >> >> Thanks for showing an interest in partition pruning. Unfortunately, >> >> it's not possible to use stabl

Re: Partition prune with stable Expr

2020-09-28 Thread Andy Fan
On Mon, Sep 28, 2020 at 9:17 PM Thomas Kellerer wrote: > Andy Fan schrieb am 28.09.2020 um 02:54: > > Well, that's very interesting. Specific to my user case, > > SELECT * FROM p WHERE pkey = to_date('2018-12-13', '-mm-dd)'; > > Why use to_date() at all for a constant value? > Can't you use

Re: Partition prune with stable Expr

2020-09-28 Thread Thomas Kellerer
Andy Fan schrieb am 28.09.2020 um 02:54: > Well, that's very interesting.  Specific to my user case,  > SELECT * FROM p WHERE pkey = to_date('2018-12-13', '-mm-dd)'; Why use to_date() at all for a constant value? Can't you use a standard ANSI date literal (date '2018-12-13')? Alternatively, y

Re: Partition prune with stable Expr

2020-09-28 Thread Andy Fan
On Mon, Sep 28, 2020 at 7:15 AM Tom Lane wrote: > Andy Fan writes: > > On Mon, Sep 28, 2020 at 4:46 AM David Rowley > wrote: > >> Thanks for showing an interest in partition pruning. Unfortunately, > >> it's not possible to use stable functions to prune partitions during > >> planning. > > > Si

Re: Partition prune with stable Expr

2020-09-28 Thread Juan José Santamaría Flecha
On Mon, Sep 28, 2020 at 9:23 AM Andy Fan wrote: > On Mon, Sep 28, 2020 at 2:44 PM Jesse Zhang wrote: > >> On Sun, Sep 27, 2020 at 7:52 PM Andy Fan wrote: >> > On Mon, Sep 28, 2020 at 9:15 AM Tom Lane wrote: >> >> >> >> Yeah. It depends on the lc_time setting, and possibly also the >> timezone >

Re: Partition prune with stable Expr

2020-09-28 Thread Andy Fan
On Mon, Sep 28, 2020 at 2:44 PM Jesse Zhang wrote: > On Sun, Sep 27, 2020 at 7:52 PM Andy Fan wrote: > > > > > > On Mon, Sep 28, 2020 at 9:15 AM Tom Lane wrote: > >> > >> Andy Fan writes: > >> > Well, that's very interesting. Specific to my user case, > >> > SELECT * FROM p WHERE pkey = to_date(

Re: Partition prune with stable Expr

2020-09-27 Thread Jesse Zhang
On Sun, Sep 27, 2020 at 7:52 PM Andy Fan wrote: > > > On Mon, Sep 28, 2020 at 9:15 AM Tom Lane wrote: >> >> Andy Fan writes: >> > Well, that's very interesting. Specific to my user case, >> > SELECT * FROM p WHERE pkey = to_date('2018-12-13', '-mm-dd)'; >> > p has 1500+ partitions and planning

Re: Partition prune with stable Expr

2020-09-27 Thread Andy Fan
On Mon, Sep 28, 2020 at 9:15 AM Tom Lane wrote: > Andy Fan writes: > > Well, that's very interesting. Specific to my user case, > > SELECT * FROM p WHERE pkey = to_date('2018-12-13', '-mm-dd)'; > > p has 1500+ partitions and planning takes lots of time, which is so same > > with SELECT * FR

Re: Partition prune with stable Expr

2020-09-27 Thread Tom Lane
Andy Fan writes: > Well, that's very interesting. Specific to my user case, > SELECT * FROM p WHERE pkey = to_date('2018-12-13', '-mm-dd)'; > p has 1500+ partitions and planning takes lots of time, which is so same > with SELECT * FROM p WHERE pkey = '2018-12-13', however the planning > time

Re: Partition prune with stable Expr

2020-09-27 Thread Andy Fan
On Mon, Sep 28, 2020 at 7:15 AM Tom Lane wrote: > Andy Fan writes: > > On Mon, Sep 28, 2020 at 4:46 AM David Rowley > wrote: > >> Thanks for showing an interest in partition pruning. Unfortunately, > >> it's not possible to use stable functions to prune partitions during > >> planning. > > > Si

Re: Partition prune with stable Expr

2020-09-27 Thread Tom Lane
Andy Fan writes: > On Mon, Sep 28, 2020 at 4:46 AM David Rowley wrote: >> Thanks for showing an interest in partition pruning. Unfortunately, >> it's not possible to use stable functions to prune partitions during >> planning. > Sigh.. I understand you now, I ignored the plan can be cached for l

Re: Partition prune with stable Expr

2020-09-27 Thread Andy Fan
Thank you David for coming:) On Mon, Sep 28, 2020 at 4:46 AM David Rowley wrote: > On Mon, 28 Sep 2020 at 08:59, Andy Fan wrote: > > I find we can't prune partitions in the planner if the qual is a stable > function. > > > IMO, we should do it. Why not? > > Thanks for showing an interest in par

Re: Partition prune with stable Expr

2020-09-27 Thread David Rowley
On Mon, 28 Sep 2020 at 08:59, Andy Fan wrote: > I find we can't prune partitions in the planner if the qual is a stable > function. > IMO, we should do it. Why not? Thanks for showing an interest in partition pruning. Unfortunately, it's not possible to use stable functions to prune partitions