Performance issue after creating partitions - Mailing list pgsql-admin

From Teja Jakkidi
Subject Performance issue after creating partitions
Date
Msg-id 10FAC7AB-09D1-4013-BB3C-79AA3AEDE374@gmail.com
Whole thread Raw
Responses Re: Performance issue after creating partitions  (Doug Reynolds <mav@wastegate.net>)
Re: Performance issue after creating partitions  (Mladen Gogala <gogala.mladen@gmail.com>)
Re: Performance issue after creating partitions  (Olivier Gautherot <ogautherot@gautherot.net>)
List pgsql-admin
Hello Admin team,

We have a Postgres 13 server set up on Google Cloud. Recently we created partitions as below for the tables:
Range on ‘order_date’  column
         List on ‘country_code’ column

Quarterly partitions for range.

Order date column is a time stamp column and when we are using this column as a filter in where condition :
trunc(order_date)= to_date(’2022-04-01’,’YYYY-MM-DD’), the query scans all the partitions dated back from the year
2000.So, instead of going to the 2022 Q2 partition directly, the query is scanning all the partitions. 
But when we remove the trunc() function and just specify order_date =‘2022-04-01 07:02:30’, this works as expected. It
goesto the correct partition directly and gets the data.  
Can Anyone help me on what’s happening in the first case and why all the partitions are being scanned?
For the first case, when there is a non partition table, it is behaving way better.

Thanks,
J. Teja.


pgsql-admin by date:

Previous
From: Frank Streitzig
Date:
Subject: Re: Postgresql 14 performance
Next
From: Doug Reynolds
Date:
Subject: Re: Performance issue after creating partitions