Re: App very unresponsive while performing simple update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Jim C. Nasby" <jnasby@xxxxxxxxxxxxx> writes:

> I tried duplicating this but couldn't. What's the data in the tables?

Sorry, I had intended to include the definition and data:

stark=> create table t1 (a integer primary key, b integer);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
CREATE TABLE

stark=> create table t2 (a integer, b integer primary key);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t2_pkey" for table "t2"
CREATE TABLE

stark=> insert into t1 values (1,2);
INSERT 0 1

stark=> insert into t2 values (1,2);
INSERT 0 1

stark=> alter table t1 add constraint fk foreign key (b) references t2 deferrable initially deferred ;
ALTER TABLE

stark=> alter table t2 add constraint fk foreign key (a) references t1 deferrable initially deferred ;
ALTER TABLE

stark=> \d t1
      Table "public.t1"
 Column |  Type   | Modifiers 
--------+---------+-----------
 a      | integer | not null
 b      | integer | 
Indexes:
    "t1_pkey" PRIMARY KEY, btree (a)
Foreign-key constraints:
    "fk" FOREIGN KEY (b) REFERENCES t2(b) DEFERRABLE INITIALLY DEFERRED

stark=> \d t2
      Table "public.t2"
 Column |  Type   | Modifiers 
--------+---------+-----------
 a      | integer | 
 b      | integer | not null
Indexes:
    "t2_pkey" PRIMARY KEY, btree (b)
Foreign-key constraints:
    "fk" FOREIGN KEY (a) REFERENCES t1(a) DEFERRABLE INITIALLY DEFERRED


stark=> select * from t1;
 a | b 
---+---
 1 | 2
(1 row)

stark=> select * from t2;
 a | b 
---+---
 1 | 2
(1 row)




-- 
greg



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux