Re: n_mod_since_analyze isn't reset at table truncation

2021-03-07 Thread Julien Rouhaud
On Mon, Mar 08, 2021 at 10:49:20AM +0900, Masahiko Sawada wrote: > On Fri, Mar 5, 2021 at 10:43 PM Masahiko Sawada wrote: > > > > On Fri, Mar 5, 2021 at 6:51 PM Julien Rouhaud wrote: > > > > > > On Fri, Mar 05, 2021 at 06:07:05PM +0900, Fujii Masao wrote: > > > > > > > > On 2021/03/05 15:59, Juli

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-07 Thread Masahiko Sawada
On Fri, Mar 5, 2021 at 10:43 PM Masahiko Sawada wrote: > > On Fri, Mar 5, 2021 at 6:51 PM Julien Rouhaud wrote: > > > > On Fri, Mar 05, 2021 at 06:07:05PM +0900, Fujii Masao wrote: > > > > > > On 2021/03/05 15:59, Julien Rouhaud wrote: > > > > > > > > I don't especially want to defer autoanalyze

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-05 Thread Julien Rouhaud
On Fri, Mar 05, 2021 at 10:43:51PM +0900, Masahiko Sawada wrote: > > I think we can use n_live_tup for that but since it's an estimation > value it doesn't necessarily have the same result as DELETE and I'm > not sure it's reliable. I agree that it's not 100% reliable, but in my experience those

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-05 Thread Masahiko Sawada
On Fri, Mar 5, 2021 at 6:51 PM Julien Rouhaud wrote: > > On Fri, Mar 05, 2021 at 06:07:05PM +0900, Fujii Masao wrote: > > > > On 2021/03/05 15:59, Julien Rouhaud wrote: > > > > > > I don't especially want to defer autoanalyze in that case. But an > > > autoanalyze > > > happening quickly after a

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-05 Thread Julien Rouhaud
On Fri, Mar 05, 2021 at 06:07:05PM +0900, Fujii Masao wrote: > > On 2021/03/05 15:59, Julien Rouhaud wrote: > > > > I don't especially want to defer autoanalyze in that case. But an > > autoanalyze > > happening quickly after a TRUNCATE is critical for performance, I'd prefer > > to > > find a

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-05 Thread Fujii Masao
On 2021/03/05 15:59, Julien Rouhaud wrote: On Fri, Mar 05, 2021 at 03:31:33PM +0900, Fujii Masao wrote: On 2021/03/04 12:40, Julien Rouhaud wrote: In that case, conversely, we want to trigger autoanalyze ASAP because the contents in the table was changed very much? We might want, but wou

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-04 Thread Julien Rouhaud
On Fri, Mar 05, 2021 at 03:31:33PM +0900, Fujii Masao wrote: > > On 2021/03/04 12:40, Julien Rouhaud wrote: > > > In that case, conversely, we want to trigger autoanalyze ASAP because the > > > contents in the table was changed very much? > > > > We might want, but wouldn't keeping the current n

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-04 Thread Fujii Masao
On 2021/03/04 12:40, Julien Rouhaud wrote: On Thu, Mar 04, 2021 at 12:21:14PM +0900, Fujii Masao wrote: On 2021/03/04 11:24, Julien Rouhaud wrote: On Thu, Mar 04, 2021 at 10:35:19AM +0900, Masahiko Sawada wrote: While reviewing "autoanalyze on partitioned table" patch, I realized that pg

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-04 Thread Masahiko Sawada
On Thu, Mar 4, 2021 at 12:39 PM Julien Rouhaud wrote: > > On Thu, Mar 04, 2021 at 12:21:14PM +0900, Fujii Masao wrote: > > > > > > On 2021/03/04 11:24, Julien Rouhaud wrote: > > > On Thu, Mar 04, 2021 at 10:35:19AM +0900, Masahiko Sawada wrote: > > > > > > > > While reviewing "autoanalyze on parti

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-04 Thread Masahiko Sawada
On Thu, Mar 4, 2021 at 11:23 AM Julien Rouhaud wrote: > > On Thu, Mar 04, 2021 at 10:35:19AM +0900, Masahiko Sawada wrote: > > > > While reviewing "autoanalyze on partitioned table" patch, I realized > > that pg_stat_xxx_tables.n_mod_since_analyze is not reset at TRUNCATE. > > On the other hand, n

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-03 Thread Julien Rouhaud
On Thu, Mar 04, 2021 at 12:21:14PM +0900, Fujii Masao wrote: > > > On 2021/03/04 11:24, Julien Rouhaud wrote: > > On Thu, Mar 04, 2021 at 10:35:19AM +0900, Masahiko Sawada wrote: > > > > > > While reviewing "autoanalyze on partitioned table" patch, I realized > > > that pg_stat_xxx_tables.n_mod_

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-03 Thread Fujii Masao
On 2021/03/04 11:24, Julien Rouhaud wrote: On Thu, Mar 04, 2021 at 10:35:19AM +0900, Masahiko Sawada wrote: While reviewing "autoanalyze on partitioned table" patch, I realized that pg_stat_xxx_tables.n_mod_since_analyze is not reset at TRUNCATE. On the other hand, n_ins_since_vacuum is rese

Re: n_mod_since_analyze isn't reset at table truncation

2021-03-03 Thread Julien Rouhaud
On Thu, Mar 04, 2021 at 10:35:19AM +0900, Masahiko Sawada wrote: > > While reviewing "autoanalyze on partitioned table" patch, I realized > that pg_stat_xxx_tables.n_mod_since_analyze is not reset at TRUNCATE. > On the other hand, n_ins_since_vacuum is reset. I think it should be > reset because o

n_mod_since_analyze isn't reset at table truncation

2021-03-03 Thread Masahiko Sawada
Hi, While reviewing "autoanalyze on partitioned table" patch, I realized that pg_stat_xxx_tables.n_mod_since_analyze is not reset at TRUNCATE. On the other hand, n_ins_since_vacuum is reset. I think it should be reset because otherwise we end up unnecessarily triggering autoanalyze even when the a