Re: [GENERAL] Select max(primary_key) taking a long time

2010-05-22 Thread Francisco Reyes
Merlin Moncure writes: do a big delete recently? any other open transactions? Some inserts were taking place. Roughly 2 to 5 million rows inside transactions. We were doing some ETL and each batch represented a file we were loading. We need to have the entire file or roll back so each file

Re: [GENERAL] Select max(primary_key) taking a long time

2010-05-22 Thread Merlin Moncure
On Fri, May 21, 2010 at 1:48 PM, Francisco Reyes wrote: > Tom Lane writes: > >> Francisco Reyes writes: >>> >>> I am trying to do >>> select max(primary_key) from some_table; >> >> Are there a whole lot of nulls in that column? > > > Zero nulls. It is a primary key. do a big delete recently? an

Re: [GENERAL] Select max(primary_key) taking a long time

2010-05-21 Thread Tom Lane
Francisco Reyes writes: > Tom Lane writes: >> Francisco Reyes writes: >>> I am trying to do >>> select max(primary_key) from some_table; >> Are there a whole lot of nulls in that column? > Zero nulls. It is a primary key. Huh. The proposed plan should have run in basically zero time then. You

Re: [GENERAL] Select max(primary_key) taking a long time

2010-05-21 Thread Francisco Reyes
Tom Lane writes: Francisco Reyes writes: I am trying to do select max(primary_key) from some_table; Are there a whole lot of nulls in that column? Zero nulls. It is a primary key. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Select max(primary_key) taking a long time

2010-05-21 Thread Tom Lane
Francisco Reyes writes: > I am trying to do > select max(primary_key) from some_table; Are there a whole lot of nulls in that column? regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www

[GENERAL] Select max(primary_key) taking a long time

2010-05-21 Thread Francisco Reyes
Postgres 8.4.1 CentOS 5.4 I am trying to do select max(primary_key) from some_table; The explain looks like: explain select max(primary_key) from some_table; QUERY PLAN -