Pagination for user sessions

Hi, I am trying to integrate keycloak into a product and I am having issues getting the user sessions from the database. I am using keycloak version 9.0.0 with postgres. I am not able to find any entries in the user_session table even though it is visible in the admin console. Is there any configuration I am missing? Any help would be appreciated.

This is a leftover from former times as the user sessions were persisted in the database. This is no more the case since a few years, sessions are only kept in (distributed) cache.

If you want to get the sessions, you’ll have to use the Admin API, but be aware that requesting session data is resource consuming and might slow down Keycloak.

Just out of curiosity, what cache does Keycloak use? Can it be configured to use something like Redis?

As Keycloak is based on Wildfly, it uses the Infinispan distributed cache implementation.
Further details can be found in the docs.