In a cluster/class, there is positions :
#<cluster-id>:<position-id> ex: #17:0, #17:1 (max position would be 1 here)
How can I efficiently retrieve the highest position in a cluster using an orientdb sql statement ?
Context : Chat use case
I need to know what is the highest position in a cluster because the chat rooms will be stored in different databases on the same server.
If there is no way to retrieve this information fast, any other suggestions are welcome to fit my use case.
create class User extends V
create vertex User
create vertex User
create vertex User
In this case we expect 2 to be returned. You can
select @rid.subString(eval("@rid.indexOf(':') + 1"))
from User order by @rid desc limit 1