Partition and Functions - Mailing list pgsql-general

From Leandro Guimarães
Subject Partition and Functions
Date
Msg-id CAJV35FOECWbh4mh=QGb8k2S3t8eszuj9GRB6WdhMpYfUYwH4=g@mail.gmail.com
Whole thread Raw
List pgsql-general
Hi Everyone,
  I have a partitioned by period table scenario here where I need to execute a query with a function in where clause. 

  I'm not sure if this is the best approach to do that, but when I use the functions, it scans all the tables instead only the desired one. If I put the parameter hardcoded, it works fine. 

  Any idea how could I solve this? Follow my query example:

SELECT customer_id, 
       date_id, 
       kpi AS kpi_value 
FROM   schema1.table1 
WHERE  date_id >= To_char(( current_date - interval '30' day ) :: DATE,'YYYYMMDD')::INTEGER 


Thanks!
Leandro Guimarães

pgsql-general by date:

Previous
From: github kran
Date:
Subject: Re: How many billion rows of data I can store in PostgreSQL RDS.
Next
From: Derek Hans
Date:
Subject: Update does not move row across foreign partitions in v11