Re: Dealing with SeqScans when Time-based Partitions Cut Over

2025-12-18 Thread Laurenz Albe
On Thu, 2025-12-18 at 13:48 -0500, Matthew Planchard wrote: > In a table with high insert frequency (~1.5k rows/s) and high query > frequency (~1k queries/s), partitioned by record creation time, we have > observed the following behavior: > > * When the current time crosses a partition boundary, a

Re: Dealing with SeqScans when Time-based Partitions Cut Over

2025-12-18 Thread Ron Johnson
On Thu, Dec 18, 2025 at 3:21 PM David Rowley wrote: > On Fri, 19 Dec 2025 at 08:55, Matthew Planchard > wrote: > > > How about just force seqscan off when the table is created? > > > ALTER TABLE SET (enable_seqscan = off); > > > > I didn't know this could be set on the table level! Our partiti

Re: Dealing with SeqScans when Time-based Partitions Cut Over

2025-12-18 Thread David Rowley
On Fri, 19 Dec 2025 at 08:55, Matthew Planchard wrote: > > How about just force seqscan off when the table is created? > > ALTER TABLE SET (enable_seqscan = off); > > I didn't know this could be set on the table level! Our partitions are > created by partman, but we have a nightly job that does

Re: Dealing with SeqScans when Time-based Partitions Cut Over

2025-12-18 Thread David Rowley
On Fri, 19 Dec 2025 at 07:48, Matthew Planchard wrote: > * Because the planner's latest knowledge of the partition was based on > its state prior to the cutover, it assumes the partition is empty and > creates plans that use sequential scans If the table/partition was just created and not ana

Re: Dealing with SeqScans when Time-based Partitions Cut Over

2025-12-18 Thread Matthew Planchard
Thanks very much for the reply and the suggestions, a lot of good stuff to look at. > What's autovacuum_analyze_scale_factor set to? The default 20% is pretty > high. > autovacuum_naptime might need to be dropped, too. This is just whatever the default is, so I will look into updating these se

Re: Dealing with SeqScans when Time-based Partitions Cut Over

2025-12-18 Thread Ron Johnson
On Thu, Dec 18, 2025 at 1:48 PM Matthew Planchard wrote: > > In a table with high insert frequency (~1.5k rows/s) and high query > frequency (~1k queries/s), partitioned by record creation time, we have > observed the following behavior: > > * When the current time crosses a partition boundary, a

Dealing with SeqScans when Time-based Partitions Cut Over

2025-12-18 Thread Matthew Planchard
In a table with high insert frequency (~1.5k rows/s) and high query frequency (~1k queries/s), partitioned by record creation time, we have observed the following behavior: * When the current time crosses a partition boundary, all new records are written to the new partition, which was previou

Dealing with SeqScans when Time-based Partitions Cut Over

2025-12-18 Thread Matthew Planchard
In a table with high insert frequency (~1.5k rows/s) and high query frequency (~1k queries/s), partitioned by record creation time, we have observed the following behavior: * When the current time crosses a partition boundary, all new records are written to the new partition, which was previou