Re: Partition pruning is not happening (even in PG18)

2025-10-18 Thread David Rowley
On Tue, 30 Sept 2025 at 02:49, Lauro Ojeda wrote: > By looking into it, I have the impression there is a bug in the costing sum > in that situation, where the cost of the "never executed" partitions should > be deducted from the final cost estimation, which would make pruning to be > the prefer

Re: Partition pruning is not happening (even in PG18)

2025-10-18 Thread Lauro Ojeda
Hi David, Thank you for your nice reply. I have the impression there is something heavily penalizing the usage of partition pruning. While trying to go a bit further, I realized that partition pruning is not occurring because the planner gives the cost of seq-scanning all partitions to just over 2

Re: Partition pruning is not happening (even in PG18)

2025-09-29 Thread Chetan
On Mon, 29 Sept 2025 at 17:55, Lauro Ojeda wrote: > Hi David, > Thank you for your nice reply. > > I have the impression there is something heavily penalizing the usage of > partition pruning. While trying to go a bit further, I realized that > partition pruning is not occurring because the plann

Re: Partition pruning is not happening (even in PG18)

2025-09-25 Thread David Rowley
On Fri, 26 Sept 2025 at 07:49, Lauro Ojeda wrote: > The only way I found to make pruning work is to force index_scan using > pg_hint_plan, but I wanted to influence the planner to decide it by itself > rather than relying on hints. What's the reason for this misbehaving and what > could I do to

Re: Partition pruning is not happening (even in PG18)

2025-09-25 Thread Michał Kłeczek
Never mind my message. I misread it and missed the plan with no hints. Michał > On 25 Sep 2025, at 22:10, Michał Kłeczek wrote: > >  > Hi, > > Partition pruning is happening: pruned nodes are marked as “never executed”. > It is just that pruning is performed not by the planner but by the ex

Re: Partition pruning is not happening (even in PG18)

2025-09-25 Thread Michał Kłeczek
Hi, Partition pruning is happening: pruned nodes are marked as “never executed”. It is just that pruning is performed not by the planner but by the executor in this case. — Michał > On 25 Sep 2025, at 21:49, Lauro Ojeda wrote: > >  > Hi super-experts, > I am trying to solve a mystery for a

Re: Partition pruning with array-contains check and current_setting function

2024-09-11 Thread Marcelo Zabani
I managed to get a plan I was hoping for, but it still doesn't prune partitions. I created a new operator #|<(integer[], integer) that is defined in SQL and is basically equivalent to value=ANY(array), and a non-stable tenants() function defined that returns an array from the setting, and with that

RE: partition pruning only works for select but update

2022-07-01 Thread James Pang (chaolpan)
[email protected] Subject: Re: partition pruning only works for select but update Justin Pryzby writes: > On Fri, Jul 01, 2022 at 08:30:40AM +, James Pang (chaolpan) wrote: >> We have other application depend on V13, possible to backport code >> changes to V13 as >> ht

Re: partition pruning only works for select but update

2022-07-01 Thread Tom Lane
Justin Pryzby writes: > On Fri, Jul 01, 2022 at 08:30:40AM +, James Pang (chaolpan) wrote: >> We have other application depend on V13, possible to backport code changes >> to V13 as >> https://git.postgresql.org/gitweb/?p=postgresql.git;a=patch;h=86dc90056dfdbd9d1b891718d2e5614e3e432f35 > I

Re: partition pruning only works for select but update

2022-07-01 Thread Justin Pryzby
> Sent: Tuesday, June 28, 2022 9:30 PM > To: James Pang (chaolpan) > Cc: [email protected] > Subject: Re: partition pruning only works for select but update > > "James Pang (chaolpan)" writes: > > But when > > Explain update tab

RE: partition pruning only works for select but update

2022-07-01 Thread James Pang (chaolpan)
Pang (chaolpan) Cc: [email protected] Subject: Re: partition pruning only works for select but update "James Pang (chaolpan)" writes: > But when > Explain update table set .. where partitionkey between to_timestamp() and > to_timestamp(); >

RE: partition pruning only works for select but update

2022-06-28 Thread James Pang (chaolpan)
Pang (chaolpan) Cc: [email protected] Subject: Re: partition pruning only works for select but update "James Pang (chaolpan)" writes: > But when > Explain update table set .. where partitionkey between to_timestamp() and > to_timestamp(); > It still

Re: partition pruning only works for select but update

2022-06-28 Thread Tom Lane
"James Pang (chaolpan)" writes: > But when > Explain update table set .. where partitionkey between to_timestamp() and > to_timestamp(); > It still show all of partitions with update ... In releases before v14, partition pruning is far stupider for UPDATE (and DELETE) than it is for SELECT.

RE: Partition pruning with joins

2020-11-04 Thread Ehrenreich, Sigrid
e this is understandable, English is not my native language 😉). Regards, Sigrid -Original Message- From: David Rowley Sent: Wednesday, November 4, 2020 9:13 PM To: Ehrenreich, Sigrid Cc: [email protected] Subject: Re: Partition pruning with joins On Wed, 4 Nov 2

Re: Partition pruning with joins

2020-11-04 Thread David Rowley
On Wed, 4 Nov 2020 at 02:20, Ehrenreich, Sigrid wrote: > > -- Statement > explain SELECT > count(*) > FROM > dim INNER JOIN fact ON (dim.part_key=fact.part_key) > WHERE dim.part_key >= 110 and dim.part_key <= 160; > > Plan shows me, that all partitions are scanned: > Aggregate (cost=461.00..461.0

RE: Partition pruning with joins

2020-11-04 Thread Ehrenreich, Sigrid
PM To: Ehrenreich, Sigrid ; [email protected] Subject: Re: Partition pruning with joins On Tue, 2020-11-03 at 13:20 +, Ehrenreich, Sigrid wrote: > I would like to join a partitioned table and have the joined columns in the > where clause to be used for partition p

Re: Partition pruning with joins

2020-11-03 Thread Laurenz Albe
On Tue, 2020-11-03 at 13:20 +, Ehrenreich, Sigrid wrote: > I would like to join a partitioned table and have the joined columns in the > where clause to be used for partition pruning. > From some readings in the internet, I conclude that this was not possible in > v12. I hoped for the > “imp

Re: Partition Pruning (Hash Partitions) Support for DELETEs in PostgreSQL 11 and 12

2020-03-23 Thread Ronnie S
Thanks! On Mon, Mar 23, 2020 at 12:10 AM Justin Pryzby wrote: > On Sun, Mar 22, 2020 at 11:45:53PM -0400, Ronnie S wrote: > > Hello All, > > > > While doing some tests with hash partitioning behavior in PG11 and 12, I > > have found that PG11 is not performing partition pruning with DELETEs > >

Re: Partition Pruning (Hash Partitions) Support for DELETEs in PostgreSQL 11 and 12

2020-03-22 Thread Justin Pryzby
On Sun, Mar 22, 2020 at 11:45:53PM -0400, Ronnie S wrote: > Hello All, > > While doing some tests with hash partitioning behavior in PG11 and 12, I > have found that PG11 is not performing partition pruning with DELETEs > (explain analyze returned >2000 lines). I then ran the same test in PG12 > a

Re: partition pruning

2019-02-14 Thread suganthi Sekar
HI , Ok thanks. Regards, Suganthi Sekar From: Laurenz Albe Sent: 14 February 2019 18:07:49 To: suganthi Sekar; [email protected] Subject: Re: partition pruning suganthi Sekar wrote: > i am using Postgresql 11, i have 2 partition ta

Re: partition pruning

2019-02-14 Thread Justin Pryzby
On Thu, Feb 14, 2019 at 01:37:49PM +0100, Laurenz Albe wrote: > There is no condition on the table "call_report2" in your query, > so it is not surprising that all partitions are scanned, right? Some people find it surprising, since: a.call_id=b.call_id suganthi Sekar wrote: > > explain analyze >

Re: partition pruning

2019-02-14 Thread Laurenz Albe
suganthi Sekar wrote: > i am using Postgresql 11, i have 2 partition table , when i joined both > table in query > a table its goes exact partition table , but other table scan all partition > > please clarify on this . > > i have enabled below parameter on in configuration file > Note : a