From: | Jan Ostrochovsky <jan(dot)ostrochovsky(at)mobiletech(dot)sk> |
---|---|
To: | Metatrader EA <metatraderea(at)gmail(dot)com> |
Cc: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Dynamic queries for Partitions |
Date: | 2016-11-24 09:22:49 |
Message-ID: | 1685623271.4216209.1479979369717.JavaMail.zimbra@mobiletech.sk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)gmail(dot)com>
> To: "pgsql-sql" <pgsql-sql(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Mallela, Anil | 2016-11-29 11:26:02 | Regarding postgres client on windows |
Previous Message | Metatrader EA | 2016-11-23 14:54:03 | Dynamic queries for Partitions |