Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eK8nP-0004rW-Pv for pgsql-general@arkaria.postgresql.org; Wed, 29 Nov 2017 20:17:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eK8nO-0007Dj-BX for pgsql-general@arkaria.postgresql.org; Wed, 29 Nov 2017 20:17:26 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eK8nO-0007DZ-12 for pgsql-general@lists.postgresql.org; Wed, 29 Nov 2017 20:17:26 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eK8nI-0003yj-Ee for pgsql-general@postgresql.org; Wed, 29 Nov 2017 20:17:24 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 021169BEA848 for ; Wed, 29 Nov 2017 13:17:19 -0700 (MST) Date: Wed, 29 Nov 2017 13:17:19 -0700 (MST) From: legrand legrand To: pgsql-general@postgresql.org Message-ID: <1511986639005-0.post@n3.nabble.com> Subject: Partition pruning / agg push down for star schema in pg v11 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, Working on Oracle migration POCs, I'm very interested in v11 and declarative partitioning optimizations. I have a typical star schema, having dimension tables "product", "calendar" and "country" and a fact table "sales". This fact table is partitionned by time (range by month) and country (list). Will query like: select product.name, calendar.month, sum(sales.net_price) from sales inner join product on (product.id = sales.cust_id) inner join country on (country.id = sales.country_id) inner join calendar on (calendar.id = sales.calendar_id) where country.name = 'HERE' and calendar.year = '2017' group by product.name,calendar.month be able to identify needed partitions ? nb: the query has predicates on dimension tables not on columns used for fact table partitioning: - country.name vs sales.country_id, - calendar.year vs sales.calendar_id. Second question: will some aggregation be pushed to the fact table ? Something like select product.name,calendar.month,agg.sum_net from (select product_id,calendar_id,sum(net_price) as sum_net from sales inner join country on (country.id = sales.country_id) inner join calendar on (calendar.id = sales.calendar_id) where country.name = 'HERE' and calendar.year = '2017') agg inner join product on (product.id = agg.cust_id) inner join calendar on (calendar.id = agg.calendar_id) group by product.name,calendar.month Thanks in advance (commitfest or patches references are welcome) Regards PAscal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html