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

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Matthew Planchard <msplanchard(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Dealing with SeqScans when Time-based Partitions Cut Over
Date: 2025-12-19 14:49:48
Message-ID: CAKAnmmL3_WPtWRrCy1t3zJOcDConYA__so4FZj_Bzzza-inJjw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

If this is still an issue after you check David's theory about premature
analyzing, another approach is to pre-populate and pre-analyze future
tables. Something like this:

* disable autovac on the future table
* detach the table from the main partition
* insert a few hundred thousand rows into it, then run analyze on it
* can pull rows from a current table, or just use random data on a key
column- whatever is enough to generate "good" stats
* delete the rows - the stats will remain
* reattach the table
* enable autovac if you like; I would not

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-12-19 16:12:29 Re: How to get single table data from backup
Previous Message Laurenz Albe 2025-12-19 14:48:45 Re: wal segment size