Hi,

Derek Slager wrote:
> If wrapped in a transaction, that would work -- but the performance would be
> rather horrible -- the MAX query is fairly DB intensive and I wouldn't
> recommend doing that in a transaction.

That depends on the database:
Any sensible database implementation will have an
index on the primary key.
Any sensible database would optimize MAX(field)
to be as fast as O(log(n)) if the field is indexed.
That is, about same speed as a
  SELECT field FROM [table] WHERE field = [value]
statement when field is indexed.

Only if field is not indexed is MAX(field)
expensive, as the database will have to traverse
all records to calculate a result.


Best Regards,

Ole Husgaard.


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to