[keycloak-user] deletion execution schedule EVENT_ENTITY

Hipfinger Martin (BCC.ÖBB.TicketShop.MA) Martin.Hipfinger at oebb.at
Wed Sep 30 09:12:47 EDT 2015


Hi,

Thank you for your quick response. I’d like to change the behaviour of keycloak, so that the deletion isn’t done every 15 minutes, but instead e.g. once daily. There are currenty 10 mio+ records in the table (and KC isn’t running since a year, which is our configured expiration – so it will grow even more), so a deletion every 15 minutes doesn’t make much sense

Br,
Martin

Von: Marko Strukelj [mailto:mstrukel at redhat.com]
Gesendet: Mittwoch, 30. September 2015 15:00
An: Hipfinger Martin (BCC.ÖBB.TicketShop.MA) <Martin.Hipfinger at oebb.at>
Cc: keycloak-user at lists.jboss.org
Betreff: Re: [keycloak-user] deletion execution schedule EVENT_ENTITY

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<mailto: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<mailto: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/97042784/attachment.html 


More information about the keycloak-user mailing list