Re: Select max(primary_key) taking a long time

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Francisco Reyes <lists(at)stringsutils(dot)com>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select max(primary_key) taking a long time
Date: 2010-05-21 18:16:53
Message-ID: 21823.1274465813@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Francisco Reyes <lists(at)stringsutils(dot)com> writes:
> Tom Lane writes:
>> Francisco Reyes <lists(at)stringsutils(dot)com> 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 might try strace'ing the backend or attaching to it with gdb to
see what it's doing.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gauthier, Dave 2010-05-21 18:46:12 Re: getting all constraint violations
Previous Message Francisco Reyes 2010-05-21 17:48:03 Re: Select max(primary_key) taking a long time