Skip site navigation (1) Skip section navigation (2)

Re: Partition elimination problem

From: "Milen Kulev" <makulev(at)gmx(dot)net>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Partition elimination problem
Date: 2006-09-18 06:07:51
Message-ID: 000001c6dae8$cc658170$ (view raw or flat)
Lists: pgsql-performance
Hi Tom,
You are right, of course :

pgpool=# set  constraint_exclusion = on ;
pgpool=# explain analyze  select * from part  where id1=3 and id2=5 ;
                                                                     QUERY PLAN

 Result  (cost=0.00..289.92 rows=3 width=130) (actual time=3.604..27.839 rows=483 loops=1)
   ->  Append  (cost=0.00..289.92 rows=3 width=130) (actual time=3.600..22.550 rows=483 loops=1)
         ->  Seq Scan on part  (cost=0.00..24.85 rows=1 width=130) (actual time=0.001..0.001 rows=0 loops=1)
               Filter: ((id1 = 3) AND (id2 = 5))
         ->  Bitmap Heap Scan on part_id1_0_10 part  (cost=1.02..9.50 rows=1 width=130) (actual time=0.014..0.014 rows=0
               Recheck Cond: (id1 = 3)
               Filter: (id2 = 5)
               ->  Bitmap Index Scan on idx_part_id1_0_10  (cost=0.00..1.02 rows=5 width=0) (actual time=0.009..0.009
rows=0 loops=1)
                     Index Cond: (id1 = 3)
         ->  Bitmap Heap Scan on part_id1_0_10__id2_0_10 part  (cost=2.52..255.56 rows=1 width=130) (actual
time=3.578..20.377 rows=483 loops=1)
               Recheck Cond: (id2 = 5)
               Filter: (id1 = 3)
               ->  Bitmap Index Scan on idx_part_id1_0_10__id2_0_10  (cost=0.00..2.52 rows=148 width=0) (actual
time=3.460..3.460 rows=5242 loops=1)
                     Index Cond: (id2 = 5)
 Total runtime: 30.576 ms

Now the execution plan  looks good. 
And now I have another problem -> constraint_exclusion  is on in the postgresql.conf file.
BUT  in my psql session I see something different ;(. Only after setting this parameter  explicitely in the session, it
What I have done wrong  ?
pgpool=# show constraint_exclusion ;
(1 row)
pgpool=# set  constraint_exclusion = on ;
pgpool=#  show constraint_exclusion ;
(1 row)

Best Regards. 

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Monday, September 18, 2006 1:14 AM
To: Milen Kulev
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] Partition elimination problem

"Milen Kulev" <makulev(at)gmx(dot)net> writes:
> My Problem is that  I don't see partiotion elimination feature
> (Parameer = constraint_exclusion is ON):

Your example works as expected for me.  You *sure* you have constraint_exclusion turned on?

                        regards, tom lane

In response to

pgsql-performance by date

Next:From: Milen KulevDate: 2006-09-18 06:09:55
Subject: Re: Partition elimination problem -> Solved
Previous:From: Tom LaneDate: 2006-09-17 23:13:32
Subject: Re: Partition elimination problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group