Add support for uid ranges query
Performances bugfixes (logout from unused sessions)