David Teran wrote:
Hi,
we have a table with about 6.000.000 rows. There is an index on a
column with the name id which is an integer and serves as primary key.
When we execute select max(id) from theTable; it takes about 10
seconds. Explain analyze returns:
Due to the open-ended nature of PG's
Hi,
we have a table with about 6.000.000 rows. There is an index on a
column with the name id which is an integer and serves as primary key.
When we execute select max(id) from theTable; it takes about 10
seconds. Explain analyze returns:
--
Hi Nick,
Try using:
SELECT id FROM theTable ORDER BY is DESC LIMIT 1;
Using COUNT, MAX, MIN and any aggregate function on the table of that
size will always result in a sequential scan. There is currently no
way around it although there are a few work arounds. See the
following for more infor
Nick Barr wrote:
David Teran wrote:
Hi,
we have a table with about 6.000.000 rows. There is an index on a
column with the name id which is an integer and serves as primary key.
When we execute select max(id) from theTable; it takes about 10
seconds. Explain analyze returns:
---
David Teran wrote:
Hi,
we have a table with about 6.000.000 rows. There is an index on a
column with the name id which is an integer and serves as primary key.
When we execute select max(id) from theTable; it takes about 10
seconds. Explain analyze returns:
-