<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
h1
        {mso-style-priority:9;
        mso-style-link:"Überschrift 1 Zchn";
        margin-top:30.0pt;
        margin-right:0cm;
        margin-bottom:4.0pt;
        margin-left:0cm;
        border:none;
        padding:0cm;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:#365F91;}
h2
        {mso-style-priority:9;
        mso-style-link:"Überschrift 2 Zchn";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:4.0pt;
        margin-left:0cm;
        border:none;
        padding:0cm;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:#365F91;
        font-weight:normal;}
h3
        {mso-style-priority:9;
        mso-style-link:"Überschrift 3 Zchn";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:4.0pt;
        margin-left:0cm;
        border:none;
        padding:0cm;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:#4F81BD;
        font-weight:normal;}
h4
        {mso-style-priority:9;
        mso-style-link:"Überschrift 4 Zchn";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:4.0pt;
        margin-left:0cm;
        border:none;
        padding:0cm;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:#4F81BD;
        font-weight:normal;
        font-style:italic;}
h5
        {mso-style-priority:9;
        mso-style-link:"Überschrift 5 Zchn";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:4.0pt;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:#4F81BD;
        font-weight:normal;}
h6
        {mso-style-priority:9;
        mso-style-link:"Überschrift 6 Zchn";
        margin-top:14.0pt;
        margin-right:0cm;
        margin-bottom:5.0pt;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:#4F81BD;
        font-weight:normal;
        font-style:italic;}
p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
        {mso-style-priority:9;
        mso-style-link:"Überschrift 7 Zchn";
        margin-top:16.0pt;
        margin-right:0cm;
        margin-bottom:5.0pt;
        margin-left:0cm;
        font-size:10.0pt;
        font-family:"Cambria",serif;
        color:#9BBB59;
        font-weight:bold;}
p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
        {mso-style-priority:9;
        mso-style-link:"Überschrift 8 Zchn";
        margin-top:16.0pt;
        margin-right:0cm;
        margin-bottom:5.0pt;
        margin-left:0cm;
        font-size:10.0pt;
        font-family:"Cambria",serif;
        color:#9BBB59;
        font-weight:bold;
        font-style:italic;}
p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
        {mso-style-priority:9;
        mso-style-link:"Überschrift 9 Zchn";
        margin-top:16.0pt;
        margin-right:0cm;
        margin-bottom:5.0pt;
        margin-left:0cm;
        font-size:10.0pt;
        font-family:"Cambria",serif;
        color:#9BBB59;
        font-style:italic;}
p.MsoCaption, li.MsoCaption, div.MsoCaption
        {mso-style-priority:35;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:9.0pt;
        font-family:"Times New Roman",serif;
        font-weight:bold;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
        {mso-style-priority:10;
        mso-style-link:"Titel Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        text-align:center;
        border:none;
        padding:0cm;
        font-size:30.0pt;
        font-family:"Cambria",serif;
        color:#243F60;
        font-style:italic;}
p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
        {mso-style-priority:11;
        mso-style-link:"Untertitel Zchn";
        margin-top:10.0pt;
        margin-right:0cm;
        margin-bottom:45.0pt;
        margin-left:0cm;
        text-align:right;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        font-style:italic;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
strong
        {mso-style-priority:22;
        letter-spacing:0pt;}
em
        {mso-style-priority:20;
        color:#5A5A5A;
        font-weight:bold;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
        {mso-style-priority:1;
        mso-style-link:"Kein Leerraum Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
        {mso-style-priority:34;
        mso-style-type:export-only;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        mso-add-space:auto;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.MsoQuote, li.MsoQuote, div.MsoQuote
        {mso-style-priority:29;
        mso-style-link:"Zitat Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:#5A5A5A;
        font-style:italic;}
p.MsoIntenseQuote, li.MsoIntenseQuote, div.MsoIntenseQuote
        {mso-style-priority:30;
        mso-style-link:"Intensives Zitat Zchn";
        margin-top:16.0pt;
        margin-right:72.0pt;
        margin-bottom:16.0pt;
        margin-left:72.0pt;
        line-height:125%;
        background:#4F81BD;
        border:none;
        padding:0cm;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:white;
        font-style:italic;}
span.MsoSubtleEmphasis
        {mso-style-priority:19;
        color:#5A5A5A;
        font-style:italic;}
span.MsoIntenseEmphasis
        {mso-style-priority:21;
        color:#4F81BD;
        font-weight:bold;
        font-style:italic;}
span.MsoSubtleReference
        {mso-style-priority:31;
        color:windowtext;
        text-decoration:underline;}
span.MsoIntenseReference
        {mso-style-priority:32;
        color:#76923C;
        font-weight:bold;
        text-decoration:underline;}
span.MsoBookTitle
        {mso-style-priority:33;
        font-family:"Cambria",serif;
        color:windowtext;
        font-weight:bold;
        font-style:italic;}
p.MsoTocHeading, li.MsoTocHeading, div.MsoTocHeading
        {mso-style-priority:39;
        margin-top:30.0pt;
        margin-right:0cm;
        margin-bottom:4.0pt;
        margin-left:0cm;
        border:none;
        padding:0cm;
        font-size:12.0pt;
        font-family:"Cambria",serif;
        color:#365F91;
        font-weight:bold;}
span.berschrift1Zchn
        {mso-style-name:"Überschrift 1 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 1";
        font-family:"Cambria",serif;
        color:#365F91;
        font-weight:bold;}
span.berschrift2Zchn
        {mso-style-name:"Überschrift 2 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 2";
        font-family:"Cambria",serif;
        color:#365F91;}
span.berschrift3Zchn
        {mso-style-name:"Überschrift 3 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 3";
        font-family:"Cambria",serif;
        color:#4F81BD;}
span.berschrift4Zchn
        {mso-style-name:"Überschrift 4 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 4";
        font-family:"Cambria",serif;
        color:#4F81BD;
        font-style:italic;}
span.berschrift5Zchn
        {mso-style-name:"Überschrift 5 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 5";
        font-family:"Cambria",serif;
        color:#4F81BD;}
span.berschrift6Zchn
        {mso-style-name:"Überschrift 6 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 6";
        font-family:"Cambria",serif;
        color:#4F81BD;
        font-style:italic;}
span.berschrift7Zchn
        {mso-style-name:"Überschrift 7 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 7";
        font-family:"Cambria",serif;
        color:#9BBB59;
        font-weight:bold;}
span.berschrift8Zchn
        {mso-style-name:"Überschrift 8 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 8";
        font-family:"Cambria",serif;
        color:#9BBB59;
        font-weight:bold;
        font-style:italic;}
span.berschrift9Zchn
        {mso-style-name:"Überschrift 9 Zchn";
        mso-style-priority:9;
        mso-style-link:"Überschrift 9";
        font-family:"Cambria",serif;
        color:#9BBB59;
        font-style:italic;}
span.TitelZchn
        {mso-style-name:"Titel Zchn";
        mso-style-priority:10;
        mso-style-link:Titel;
        font-family:"Cambria",serif;
        color:#243F60;
        font-style:italic;}
span.UntertitelZchn
        {mso-style-name:"Untertitel Zchn";
        mso-style-priority:11;
        mso-style-link:Untertitel;
        font-style:italic;}
span.KeinLeerraumZchn
        {mso-style-name:"Kein Leerraum Zchn";
        mso-style-priority:1;
        mso-style-link:"Kein Leerraum";}
span.ZitatZchn
        {mso-style-name:"Zitat Zchn";
        mso-style-priority:29;
        mso-style-link:Zitat;
        font-family:"Cambria",serif;
        color:#5A5A5A;
        font-style:italic;}
span.IntensivesZitatZchn
        {mso-style-name:"Intensives Zitat Zchn";
        mso-style-priority:30;
        mso-style-link:"Intensives Zitat";
        font-family:"Cambria",serif;
        color:white;
        background:#4F81BD;
        font-style:italic;}
span.E-MailFormatvorlage46
        {mso-style-type:personal-reply;
        font-family:"Arial",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Arial",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE-AT" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US">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<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Br,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Martin<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="DE" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Von:</span></b><span lang="DE" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Marko Strukelj [mailto:mstrukel@redhat.com]
<br>
<b>Gesendet:</b> Mittwoch, 30. September 2015 15:00<br>
<b>An:</b> Hipfinger Martin (BCC.ÖBB.TicketShop.MA) <Martin.Hipfinger@oebb.at><br>
<b>Cc:</b> keycloak-user@lists.jboss.org<br>
<b>Betreff:</b> Re: [keycloak-user] deletion execution schedule EVENT_ENTITY<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Another way to maybe address this would be to only delete small number of records at a time:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">delete from EVENT_ENTITY where EVENT_ID in (select EVENT_ID from EVENT_ENTITY where REALM_ID=:1 and EVENT_TIME<:2 limit 100)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Sep 30, 2015 at 2:33 PM, Hipfinger Martin (<a href="http://bcc.xn--bb-eka.ticketshop.ma">BCC.ÖBB.TicketShop.MA</a>) <<a href="mailto:Martin.Hipfinger@oebb.at" target="_blank">Martin.Hipfinger@oebb.at</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">we’ve enabled event logging in Realm -> Events -> Config: Save Events ON, Expiration: 365 days</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">KC executes the following statement every 15 minutes:
</span><b><span lang="EN-GB" style="font-family:"Courier New";color:#4444DD">delete</span></b><span lang="EN-GB" style="font-family:"Courier New";color:black"> </span><b><span lang="EN-GB" style="font-family:"Courier New";color:#4444DD">from</span></b><span lang="EN-GB" style="font-family:"Courier New";color:black"> EVENT_ENTITY </span><b><span lang="EN-GB" style="font-family:"Courier New";color:#4444DD">where</span></b><span lang="EN-GB" style="font-family:"Courier New";color:black"> REALM_ID=:1 </span><b><span lang="EN-GB" style="font-family:"Courier New";color:#4444DD">and</span></b><span lang="EN-GB" style="font-family:"Courier New";color:black"> EVENT_TIME<:2 </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">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? </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thx & br,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Martin<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><br>
_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>