Re: Select max(primary_key) taking a long time - Mailing list pgsql-general

From Tom Lane
Subject Re: Select max(primary_key) taking a long time
Date
Msg-id 21823.1274465813@sss.pgh.pa.us
Whole thread Raw
In response to Re: Select max(primary_key) taking a long time  (Francisco Reyes <lists@stringsutils.com>)
List pgsql-general
Francisco Reyes <lists@stringsutils.com> writes:
> Tom Lane writes:
>> Francisco Reyes <lists@stringsutils.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

pgsql-general by date:

Previous
From: Francisco Reyes
Date:
Subject: Re: Select max(primary_key) taking a long time
Next
From: "Gauthier, Dave"
Date:
Subject: Re: getting all constraint violations