From: keithf4 (@keithf4) <noreply+keithf4@github.com>
To: pgpartman/pg_partman <noreply+pgpartman-pg_partman@github.com>
Subject: Re: [pgpartman/pg_partman] discussion #877: Full table scan of default partition during partman maintenance (ATTACH PARTITION)
Date: Thu, 29 Oct 2026 17:36:53 +0000
Message-ID: <gh-pgpartman-pg_partman-877-dc19274169@github.com> (raw)
In-Reply-To: <gh-pgpartman-pg_partman-877@github.com>
References: <gh-pgpartman-pg_partman-877@github.com>
As for your proposal, whether something uses an index or sequential scan when pulling the table out of the default, that's really down to how much of the table it's considering to move. If it's over 40-50% of the table that it's scanning, PG will typically default to a seq scan because it actually ends up being cheaper (avoids the index lookup overhead). To force index scans in that case, you'd have to reduce the size of the batches being moved. If it needs to be smaller than the partition interval, you'll have to look into the async partitioning introduced in v5.3.0. But carefully read the caveats that come with this method (data goes "missing" while it's moved).
If you're talking about what PG itself is doing when deciding whether to put something in the default, or what happens when you add a new child table and it's scanning the default table, that's entirely due to PG internals and I don't really have any control over that in pg_partman.