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

BUG #3479: contraint exclusion and locks

From: "Tiago Jacobs" <tiago(at)mdtestudio(dot)com(dot)br>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3479: contraint exclusion and locks
Date: 2007-07-23 13:24:08
Message-ID: 200707231324.l6NDO8Nm010057@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      3479
Logged by:          Tiago Jacobs
Email address:      tiago(at)mdtestudio(dot)com(dot)br
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

Responses

pgsql-bugs by date

Next:From: Andrei BadeaDate: 2007-07-23 13:58:47
Subject: BUG #3480: JDBC driver: getIndexInfo() returns quotes around quoted column names
Previous:From: Walter RoelandDate: 2007-07-21 04:54:24
Subject: BUG #3476: description of root.crt/crl in documentation

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