The following bug has been logged online:

Bug reference:      3479
Logged by:          Tiago Jacobs
Email address:      [EMAIL PROTECTED]
PostgreSQL version: 8.2.4
Operating system:   Linux 2.6.21.5
Description:        contraint exclusion and locks
Details: 

Hi People!

Connection #1
create table tab (dt_tab date);
create table tab_2 () inherits (tab);
create table tab_1 () inherits (tab);
alter table tab_2 add constraint constraint_x check (dt_tab >= '20070701');
alter table tab_2 add constraint constraint_y check (dt_tab <= '20070731');
alter table tab_1 add constraint constraint_x check (dt_tab >= '20070601');
alter table tab_1 add constraint constraint_y check (dt_tab <= '20070630');

explain select * from tab where dt_tab = '20070705';

>"Result  (cost=0.00..73.50 rows=22 width=4)"
>"  ->  Append  (cost=0.00..73.50 rows=22 width=4)"
>"        ->  Seq Scan on tab  (cost=0.00..36.75 rows=11 width=4)"
>"              Filter: (dt_tab = '2007-07-05'::date)"
>"        ->  Seq Scan on tab_2 tab  (cost=0.00..36.75 rows=11 width=4)"
>"              Filter: (dt_tab = '2007-07-05'::date)"


Connection #2
begin;
lock table tab_1 in exclusive mode;
TrUNCATE TABLE tab_1;

Connection #1
explain select * from tab where dt_tab = '20070705'

oh-ow... It waits while the table (That is not used) is locked.

Even that the final plan dont use tab_2007_07, it wait for unlock of table
for make the plan.

So, if I`m running a VACUUM on specific table, all the querys on the
"master" table don't work.

Best Regards,
Tiago

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to