Re: Dynamic queries for Partitions
От | Jan Ostrochovsky |
---|---|
Тема | Re: Dynamic queries for Partitions |
Дата | |
Msg-id | 1685623271.4216209.1479979369717.JavaMail.zimbra@mobiletech.sk обсуждение исходный текст |
Ответ на | Dynamic queries for Partitions (Metatrader EA <metatraderea@gmail.com>) |
Список | 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 по дате отправления: