Re: [PERFORM] Regression: 8.3 2 seconds -> 8.4 100+ seconds

2010-12-28 Thread Greg Smith
Reviving a thread from two months ago...Francisco asked about a query that was much slower in 8.3 at http://archives.postgresql.org/message-id/cone.1288183283.263738.5695.1...@shelca There was some theorizing about a stats problem. I've now pulled pg_stats data from the production server, and

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread Tom Lane
Florian Weimer writes: >> Whenever I try to create a new table "bbb" with foreign key pointing >> to "aaa". The operation locks, and reading "aaa" is not possible. The >> query also never seems to finish. What that sounds like to me is there's some long-running (probably idle) open transaction th

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread Kevin Grittner
Gurjeet Singh wrote: > Isn't it a requirement that the FKey referenced columns be UNIQUE > or PRIMARY KEY'd already? Ah, so it is. Never mind. -Kevin -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.o

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread Gurjeet Singh
On Tue, Dec 28, 2010 at 8:55 AM, kakarukeys wrote: > > > How long did you wait? > hours in the past. > For recent happenings, I aborted after 10 mins. > > Since it's a new table's creation, 'bbb' is empty. > The 'alter table' never finished, so the lock was not released. > aaa.id, bbb.topic_id ar

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread Gurjeet Singh
On Tue, Dec 28, 2010 at 9:43 AM, Kevin Grittner wrote: > Gurjeet Singh wrote: > > > how many rows does "bbb" have? And what are the data types of > > column aaa.idand bbb.topic_id? > > For that matter, is there a unique index (directly or as the result > of a constraint) on the aaa.id column (by

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread Florian Weimer
> Whenever I try to create a new table "bbb" with foreign key pointing > to "aaa". The operation locks, and reading "aaa" is not possible. The > query also never seems to finish. Do you mean that the ALTER query and subsequent queries are shown as "waiting" in pg_stat_activity? In this case, I'm

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread kakarukeys
On Dec 28, 9:37 pm, singh.gurj...@gmail.com (Gurjeet Singh) wrote: > On Tue, Dec 28, 2010 at 2:08 AM, kakarukeys wrote: > > I have a table "aaa" which is not very big. It has less than 10'000 > > rows. However read operations on this table is very frequent. > > > Whenever I try to create a new tab

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread Lew
On 12/28/2010 02:08 AM, kakarukeys wrote: I have a table "aaa" which is not very big. It has less than 10'000 rows. However read operations on this table is very frequent. Whenever I try to create a new table "bbb" with foreign key pointing to "aaa". The operation locks, and reading "aaa" is not

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread Kevin Grittner
Gurjeet Singh wrote: > how many rows does "bbb" have? And what are the data types of > column aaa.idand bbb.topic_id? For that matter, is there a unique index (directly or as the result of a constraint) on the aaa.id column (by itself)? -Kevin -- Sent via pgsql-performance mailing list (pg

Re: [PERFORM] adding foreign key constraint locks up table

2010-12-28 Thread Gurjeet Singh
On Tue, Dec 28, 2010 at 2:08 AM, kakarukeys wrote: > I have a table "aaa" which is not very big. It has less than 10'000 > rows. However read operations on this table is very frequent. > > Whenever I try to create a new table "bbb" with foreign key pointing > to "aaa". The operation locks, and re