Re: Partition elimination problem - Mailing list pgsql-performance

From Milen Kulev
Subject Re: Partition elimination problem
Date
Msg-id 000001c6dae8$cc658170$0a00a8c0@trivadis.com
Whole thread Raw
In response to Re: Partition elimination problem  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance

Hi Tom,
You are right, of course :


pgpool=# set  constraint_exclusion = on ;
SET
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 loops=1)
               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 works.
What I have done wrong  ?
 
 
pgpool=# show constraint_exclusion ;
 constraint_exclusion
----------------------
 off
(1 row)
 
pgpool=# set  constraint_exclusion = on ;
SET
pgpool=#  show constraint_exclusion ;
 constraint_exclusion
----------------------
 on
(1 row)
 
Best Regards.
Milen


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


"Milen Kulev" <makulev@gmx.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

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Partition elimination problem
Next
From: "Milen Kulev"
Date:
Subject: Re: Partition elimination problem -> Solved