pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Beena Emerson <memissemerson@gmail.com>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: amul sul <sulamul@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Dilip Kumar <dilipbalaut@gmail.com>
Subject: Re: [HACKERS] Runtime Partition Pruning
Date: Thu, 4 Jan 2018 13:37:08 -0300
Message-ID: <20180104163708.bzgheqsny6tsatzf@alvherre.pgsql> (raw)
In-Reply-To: <CAKJS1f-zohKp_ANHYMe49nNje4vb81nF9s9EicK8KsjqQNkQ1A@mail.gmail.com>

I tried this patch (applying it on Amit's last current version on top of
4e2970f8807f which is the latest it applies to) and regression tests
fail with the attached diff; in all cases it appears to be an off-by-one
in row count.  Would you please give it a look?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
*** /pgsql/source/master/src/test/regress/expected/partition_prune.out	2018-01-04 13:29:04.518589165 -0300
--- /home/alvherre/Code/pgsql/build/master/src/test/regress/results/partition_prune.out	2018-01-04 13:33:41.003865074 -0300
***************
*** 1836,1842 ****
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=51 loops=2)
                             Filter: (a = ANY ('{0,0,1}'::integer[]))
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=1)
--- 1836,1842 ----
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
                             Filter: (a = ANY ('{0,0,1}'::integer[]))
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=1)
***************
*** 1919,1927 ****
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=51 loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 1
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=1)
                                   Index Cond: (a = a.a)
--- 1919,1927 ----
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 0
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=1)
                                   Index Cond: (a = a.a)
***************
*** 1964,1970 ****
                 ->  Nested Loop (actual rows=0 loops=2)
                       ->  Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 1
                       ->  Append (actual rows=0 loops=100)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (never executed)
                                   Index Cond: (a = a.a)
--- 1964,1970 ----
                 ->  Nested Loop (actual rows=0 loops=2)
                       ->  Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 0
                       ->  Append (actual rows=0 loops=100)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (never executed)
                                   Index Cond: (a = a.a)
***************
*** 2203,2209 ****
           ->  Index Only Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 2
!          ->  Index Only Scan using tprt3_idx on tprt_3 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 1
           ->  Index Only Scan using tprt4_idx on tprt_4 (never executed)
--- 2203,2209 ----
           ->  Index Only Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 2
!          ->  Index Only Scan using tprt3_idx on tprt_3 (actual rows=0 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 1
           ->  Index Only Scan using tprt4_idx on tprt_4 (never executed)

======================================================================

Attachments:

  [text/plain] regression.diffs (4.2K, ../20180104163708.bzgheqsny6tsatzf@alvherre.pgsql/2-regression.diffs)
  download | inline:
*** /pgsql/source/master/src/test/regress/expected/partition_prune.out	2018-01-04 13:29:04.518589165 -0300
--- /home/alvherre/Code/pgsql/build/master/src/test/regress/results/partition_prune.out	2018-01-04 13:33:41.003865074 -0300
***************
*** 1836,1842 ****
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=51 loops=2)
                             Filter: (a = ANY ('{0,0,1}'::integer[]))
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=1)
--- 1836,1842 ----
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
                             Filter: (a = ANY ('{0,0,1}'::integer[]))
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=1)
***************
*** 1919,1927 ****
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=51 loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 1
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=1)
                                   Index Cond: (a = a.a)
--- 1919,1927 ----
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 0
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (actual rows=0 loops=1)
                                   Index Cond: (a = a.a)
***************
*** 1964,1970 ****
                 ->  Nested Loop (actual rows=0 loops=2)
                       ->  Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 1
                       ->  Append (actual rows=0 loops=100)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (never executed)
                                   Index Cond: (a = a.a)
--- 1964,1970 ----
                 ->  Nested Loop (actual rows=0 loops=2)
                       ->  Parallel Seq Scan on lprt_a a (actual rows=50 loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 0
                       ->  Append (actual rows=0 loops=100)
                             ->  Index Only Scan using ab_a1_b1_a_idx on ab_a1_b1 (never executed)
                                   Index Cond: (a = a.a)
***************
*** 2203,2209 ****
           ->  Index Only Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 2
!          ->  Index Only Scan using tprt3_idx on tprt_3 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 1
           ->  Index Only Scan using tprt4_idx on tprt_4 (never executed)
--- 2203,2209 ----
           ->  Index Only Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 2
!          ->  Index Only Scan using tprt3_idx on tprt_3 (actual rows=0 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 1
           ->  Index Only Scan using tprt4_idx on tprt_4 (never executed)

======================================================================

view thread (186+ messages)  latest in thread

Message-ID: <20180104163708.bzgheqsny6tsatzf@alvherre.pgsql>
Permalink:  ../20180104163708.bzgheqsny6tsatzf@alvherre.pgsql/
Also on:    postgresql.org/message-id/20180104163708.bzgheqsny6tsatzf@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, david.rowley@2ndquadrant.com, memissemerson@gmail.com, Langote_Amit_f8@lab.ntt.co.jp, robertmhaas@gmail.com, sulamul@gmail.com, dilipbalaut@gmail.com
  Subject: Re: [HACKERS] Runtime Partition Pruning
  In-Reply-To: <20180104163708.bzgheqsny6tsatzf@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox