## Re: Partition elimination problem

From: "Milen Kulev" "'Tom Lane'" Re: Partition elimination problem 2006-09-18 06:07:51 000001c6dae8\$cc658170\$0a00a8c0@trivadis.com (view raw or whole thread) 2006-09-17 22:12:33 from "Milen Kulev"  2006-09-17 23:13:32 from Tom Lane   2006-09-18 06:07:51 from "Milen Kulev"   2006-09-18 06:09:55 from "Milen Kulev" 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(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

```

### pgsql-performance by date

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