Re: Dynamic queries for Partitions - Mailing list pgsql-sql

From Jan Ostrochovsky
Subject Re: Dynamic queries for Partitions
Date
Msg-id 1685623271.4216209.1479979369717.JavaMail.zimbra@mobiletech.sk
Whole thread Raw
In response to Dynamic queries for Partitions  (Metatrader EA <metatraderea@gmail.com>)
List pgsql-sql
Hello Bill,

if I understand correctly, you need to have constraint exclusion turned on and be careful about types - types in WHERE condition should be the same as those with CHECK constraint in partitioned table. Then you won't need 2 steps, but just one - one SELECT from master table fits all. Details are in the PostgreSQL documentation (Partitioning).

Jano


From: "Metatrader EA" <metatraderea@gmail.com>
To: "pgsql-sql" <pgsql-sql@postgresql.org>
Sent: Wednesday, 23 November, 2016 15:54:03
Subject: [SQL] Dynamic queries for Partitions
Hi,

When I run one query on one partitioned table.

Select * from customer where opendate = (date_trunc('month', current_date)+'11 days'::interval)::date ;

This query will do that postgres will check all my partitions.

How can I do ?

Step 1 generate one sql that will be like "Select * from customer where opendate = '2016-11-01' ;

Step 2 :: Then run code from step1.

Any advice?

//Bill

pgsql-sql by date:

Previous
From: Metatrader EA
Date:
Subject: Dynamic queries for Partitions
Next
From: "Mallela, Anil"
Date:
Subject: Regarding postgres client on windows