cancel
Showing results for 
Search instead for 
Did you mean: 

select count() works, select max(id) doesn't

2,124

Hi,
Our customer has a strange problem with a very tiny table (it has only 100-200 rows):

CREATE TABLE test (
    id BIGINT PRIMARY KEY DEFAULT AUTOINCREMENT,
    uid BIGINT NULL
)

These statements do work immediately:

SELECT count() from test;
SELECT min(id) from test;
SELECT FIRST id FROM test ORDER BY id DESC;

This statement doesn't, i. e. runs "forever":

SELECT max(id) from test;

Execution plan for this statement:

( Plan [B]
  ( SingleRowGroupBy 
    ( RowLimit 
      ( IndexOnlyScan test test**(R) )
    )
  )
)

This happens only in one DB instance, other instances work as expected.
The table and its primary key were validated without errors.
Isolation_level is always 0, so locking problems should not be the reason.

Any thoughts, what else should we check or do to make it work?

Version - SA11.

Thanks.

Accepted Solutions (0)

Answers (0)