[keycloak-user] deletion execution schedule EVENT_ENTITY

Marko Strukelj mstrukel at redhat.com
Wed Sep 30 08:59:32 EDT 2015

I suppose in this case the problem is that query to identify records to
delete takes a long time, but number of actual records to delete is small.
In that case it makes sense to prolong the 'garbage collection' period. If
the number of records to delete is big, and that causes a long table lock
then the situation with bigger timeout may make things even worse.

Did you maybe check what indexes are set on this table if any? Depending on
the database, creating a different index or changing an index type can make
a huge difference.

Another way to maybe address this would be to only delete small number of
records at a time:

delete from EVENT_ENTITY where EVENT_ID in (select EVENT_ID from
EVENT_ENTITY where REALM_ID=:1 and EVENT_TIME<:2 limit 100)

On Wed, Sep 30, 2015 at 2:33 PM, Hipfinger Martin (BCC.ÖBB.TicketShop.MA
<http://bcc.xn--bb-eka.ticketshop.ma>) <Martin.Hipfinger at oebb.at> wrote:

> Hi,
> we’ve enabled event logging in Realm -> Events -> Config: Save Events ON,
> Expiration: 365 days
> KC executes the following statement every 15 minutes: *delete* *from*
> EVENT_ENTITY *where* REALM_ID=:1 *and* EVENT_TIME<:2
> As the table event_entity is quite big, we’d like to reduce the frequency
> of deletion – so I’d like to ask if there is any possibility to change the
> execution schedule of deletion?
> Thx & br,
> Martin
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20150930/0bce69ba/attachment-0001.html 

More information about the keycloak-user mailing list