partition pruning only works for select but update - Mailing list pgsql-performance

From James Pang (chaolpan)
Subject partition pruning only works for select but update
Date
Msg-id PH0PR11MB519134D4171A126776E3E063D6B89@PH0PR11MB5191.namprd11.prod.outlook.com
Whole thread Raw
Responses Re: partition pruning only works for select but update
List pgsql-performance

Hi,

  We have a table have range partition (about 5K partitions) , when

Explain select count(*) from table where  partitionkey between  to_timestamp() and to_timestamp();

It show

Aggregate  (cost=15594.72..15594.73 rows=1 width=8)

   ->  Append  (cost=0.15..15582.00 rows=5088 width=0)

         Subplans Removed: 5086

 

But when

Explain update table set .. where  partitionkey between  to_timestamp() and to_timestamp();

  It still show all of partitions with update …

 

enable_partition_pruning keep defaut value ‘on’, It’s expected ?  and we found for update sql with same where condition, it consumes huge memory than select.

Database version is Postgres 13.4 on RHEL8.4.

 

 

Thanks,

 

James

   

pgsql-performance by date:

Previous
From: "I. V."
Date:
Subject: Re: reindex option for tuning load large data
Next
From: Tom Lane
Date:
Subject: Re: partition pruning only works for select but update