Re: Query Performance Degradation Due to Partition Scan Order – PostgreSQL v17.6
От | Andrei Lepikhov |
---|---|
Тема | Re: Query Performance Degradation Due to Partition Scan Order – PostgreSQL v17.6 |
Дата | |
Msg-id | 17c0dab3-5995-4c18-9354-400803f967df@gmail.com обсуждение исходный текст |
Ответ на | Re: Query Performance Degradation Due to Partition Scan Order – PostgreSQL v17.6 (Vivek Gadge <vvkgadge56@gmail.com>) |
Список | pgsql-hackers |
On 8/9/2025 13:39, Vivek Gadge wrote: > > For example, when a query runs on a partitioned table, PostgreSQL scans > partitions in the order they were created or attached to the parent > table. In our case (monthly partitions from January through September), > this means that queries looking for recent data (e.g., September) may > experience additional overhead. PostgreSQL evaluates the older > partitions first, checking their constraints and in some cases probing > their indexes, before reaching the later partitions that actually > contain the needed data. > > As a result, while the query results are correct, the execution time > increases due to unnecessary work on irrelevant partitions. This > performance impact is more noticeable when the target partition is at > the end of the scan order and pruning cannot fully eliminate the earlier > partitions. The case looks straightforward. But just to be sure that we are on the same page, could you provide a synthetic DB example and a query representing the exact problem you are going to resolve? -- regards, Andrei Lepikhov
В списке pgsql-hackers по дате отправления: