From: | "Alex" <alex(at)xdcom(dot)org> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #4800: constraint_exclusion could be smarter with bool conversion |
Date: | 2009-05-08 10:36:18 |
Message-ID: | 200905081036.n48AaITQ052818@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 4800
Logged by: Alex
Email address: alex(at)xdcom(dot)org
PostgreSQL version: 8.3.6
Operating system: rhel5
Description: constraint_exclusion could be smarter with bool
conversion
Details:
Table "public.foo1"
Column | Type | Modifiers
-------------+------------------------+--------------------
val | character varying(16) | not null
mask | integer | default 0
Check constraints:
"foo_1_mask_check" CHECK (mask = 1)
Inherits: foo
=> EXPLAIN select * from foo1 where mask >1;
QUERY PLAN
------------------------------------------
Result (cost=0.00..0.01 rows=1 width=0)
One-Time Filter: false
(2 rows)
=> EXPLAIN select * from foo1 where (mask &2)::bool;
QUERY PLAN
-----------------------------------------------------------------
Seq Scan on foo1 (cost=0.00..100.32 rows=896 width=59)
Filter: ((mask & 2))::boolean
(2 rows)
There many children of table foo like foo1,..fooN. with different
check(mask=2^N).
I wish constraint_exclusion to be smarter with bool conversion so that
'select * from foo where (mask&5)::bool' can be faster;
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Much | 2009-05-08 12:26:51 | BUG #4801: Performance failure: 600 MB written to each WAL log |
Previous Message | Alex | 2009-05-08 09:31:28 | BUG #4799: BitMapAnd never works with gin |