[keycloak-user] Keycloak very slow on retrieving "events" (Sarp Kaya)

Johan Heylen johan.heylen.public at gmail.com
Wed Jul 5 03:08:38 EDT 2017


We faced the same problem and added a series of indexes on the events table.

CREATE INDEX idx_event_entity_user_id_realm_id_dnsbelgium ON event_entity
USING btree (user_id, realm_id);
CREATE INDEX idx_event_entity_user_id_type_dnsbelgium ON event_entity USING
btree (user_id, type);
CREATE INDEX idx_event_entity_type_dnsbelgium ON event_entity USING btree
(type);
CREATE INDEX idx_event_entity_realm_id_dnsbelgium ON event_entity USING
btree (realm_id);
CREATE INDEX idx_event_entity_client_id_dnsbelgium ON event_entity USING
btree (client_id);
CREATE INDEX idx_event_entity_user_id_dnsbelgium ON event_entity USING
btree (user_id);

and now queries are working fast

Johan

On 4 July 2017 at 08:41, Sarp Kaya <akaya at expedia.com> wrote:

> Hello,
>
> When I click on Events, it takes very long time (more than a minute) just
> to display first 5 events. I checked what endpoint it uses and it?s using
> this:
>
> "/auth/admin/realms/<realm-id>/events?first=0&max=5? endpoint.
>
> I believe that there is something broken with the filtering option as it
> should never take more than a minute to just retrieve 5 results.
>
> I?m using Keycloak 3.1.0 and MySQL for the database.


More information about the keycloak-user mailing list