<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:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@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;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 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;}
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;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Vorformatiert Zchn";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLVorformatiertZchn
{mso-style-name:"HTML Vorformatiert Zchn";
mso-style-priority:99;
mso-style-link:"HTML Vorformatiert";
font-family:Consolas;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
p.firma, li.firma, div.firma
{mso-style-name:firma;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.nombre
{mso-style-name:nombre;}
span.letra
{mso-style-name:letra;}
span.E-MailFormatvorlage23
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@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:"Calibri",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:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>i have now generated a db of similar size:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>provision subscribers completed:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'> total contracts: 100269 rows<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'> total subscribers: 100216 rows<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'> total aliases: 100167 rows<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'> primary aliases: 100167 rows<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>generate cdrs completed:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'> total CDRs: 500100 rows<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>time elapsed: 04:33:39<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>the differnece to Alejandro’s DB is that his one will show a larger billing.billing_mappings<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>table. (can you report how many records?)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>on my laptop runnung the currently implemented query against that generated db takes<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>-19 secs when it does not hit cdrs. „hit“ means the cdr start time is covered by the queries BETWEEN clause.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>-3mins40secs when it hits 500k cdrs and reports 45k contracts exceeding a profile’s daily limit<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>-the query time reduces to 1-2 secs when reapeating it (ie. temptables got cached)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>-running the query when the database was under load (while populating the data) went up to 10 minutes, app. 2minutes of which required to gather the actual billing mappings subquery (also for the last query variant i posted)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>This is what’s expected with the current structure. Ist ok for the fraud jobs running once a day.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>i agree it’s too slow for accessing /api/customerfraudevents frequently.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>In november the query was patched to address profile level fraud limits to work properly (at the cost of performance).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>so one option for Alejandro ist o use the acc-cleanup.pl tool to move cdrs from the cdr table to monthly tables.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Another option ist o collapse billing mappings records (for which a tool could be made).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>On the Other hand, a change oft he billing mappings table structure is planned on our side.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Before this bigger refactoring, another goal is to avoid the fraud jobs in favour of getting the fraud alarms generated by the rating engine directly/instantly - a recent fix for „free cash“ also makes the „debit“/“Spent this interval“ summary fields to show concise sums meanwhile. This is also an indirect answer to walters point: customers prefer the fraud alarms more aggressively rather than relaxed/delayed – some prefer to run the fraud jobs hourly or even in 15 min intervals. Changing the BETWEEN clause to eg. the last day will not change the speed oft he query.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>regards, rene<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><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'> Walter Klomp [mailto:walter@myrepublic.net] <br><b>Gesendet:</b> Donnerstag, 25. Jänner 2018 18:12<br><b>An:</b> Alejandro Grijalba <agrijalba@innovasur.es><br><b>Cc:</b> Rene Krenn <rkrenn@sipwise.com>; spce-user@lists.sipwise.com<br><b>Betreff:</b> Re: [Spce-user] Fraud calculation takes hours<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><div><p class=MsoNormal><span style='font-family:"Helvetica",sans-serif;color:black'>Hi,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Helvetica",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal>I actually moved my database to external server and optimised some indexes to make this faster (but SSD and more memory definitely helps)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>While you (Sipwise) are at it to optimise this query, you may also want to consider to calculate this not from the 1st of the month, but from a month before, until now…<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>so if you do the calculation today it should run from 27 Dec to 26 Jan (this time) - so that it’s a more accurate period, otherwise in the beginning of the month somebody can do a huge amount of fraud, and at the end of the month they run out immediately. Same for the daily limits, they should be from yesterday, current time, to now.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>as in this example.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=0 style='width:259.8pt;-webkit-text-stroke-width: 0px;word-spacing:0px'><tr><td valign=top style='padding:0cm 0cm 0cm 0cm'><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre style='background:white'><span style='color:black'>WHERE CASE WHEN bpinfo.interval = 'month'<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> THEN cdr.start_time<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> BETWEEN UNIX_TIMESTAMP(DATE_FORMAT(NOW() - INTERVAL 1 MONTH, '%Y-%m-%d %H:%i:%s'))<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> AND UNIX_TIMESTAMP(DATE_FORMAT(NOW(),<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> '%Y-%m-%d %H:%i:%s'))-1<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> ELSE cdr.start_time<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> BETWEEN UNIX_TIMESTAMP(DATE_FORMAT(NOW() - INTERVAL 1 DAY, '%Y-%m-%d %H:%i:%S'))<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> AND UNIX_TIMESTAMP(DATE_FORMAT(NOW(),<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> '%Y-%m-%d %H:%i:%S'))<o:p></o:p></span></pre><pre style='background:white'><span style='color:black'> END<o:p></o:p></span></pre></blockquote></blockquote><div><p class=MsoNormal><span style='font-family:"Courier New";color:#5856D6'>Does that make sense ?</span><span style='font-family:"Helvetica",sans-serif;color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Helvetica",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Courier New";color:#5856D6'>Thanks</span><span style='font-family:"Helvetica",sans-serif;color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Courier New";color:#5856D6'>Walter</span><span style='font-family:"Helvetica",sans-serif;color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Courier New";color:#5856D6'><br><br><br><br><br></span><span style='font-family:"Helvetica",sans-serif;color:black'><o:p></o:p></span></p></div></td></tr></table></table></div></div><div><p class=MsoNormal><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>On 26 Jan 2018, at 12:08 AM, Alejandro Grijalba <<a href="mailto:agrijalba@innovasur.es">agrijalba@innovasur.es</a>> wrote:<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal style='background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>10 minutes and counting so far :(<br><br><br>El 25/01/2018 a las 16:45, Rene Krenn escribió:<o:p></o:p></span></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt;font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:0px'><pre style='background:white'>Hi,<o:p></o:p></pre><pre style='background:white'><o:p> </o:p></pre><pre style='background:white'>thanks for pointing.<o:p></o:p></pre><pre style='background:white'><o:p> </o:p></pre><pre style='background:white'>Can you try running this modified query below on your test database a few times,<o:p></o:p></pre><pre style='background:white'>and report back how long it took (longer or less 2 minutes)?<o:p></o:p></pre><pre style='background:white'><o:p> </o:p></pre><pre style='background:white'>SELECT <a href="http://bpinfo.id/"><span style='color:#FF2600'>bpinfo.id</span></a>, bpinfo.reseller_id, bpinfo.interval, bpinfo.type,<o:p></o:p></pre><pre style='background:white'> IF (bpinfo.fraud_use_reseller_rates > 0, <o:p></o:p></pre><pre style='background:white'> SUM(cdr.source_reseller_cost),<o:p></o:p></pre><pre style='background:white'> SUM(cdr.source_customer_cost)) as interval_cost,<o:p></o:p></pre><pre style='background:white'> bpinfo.interval_limit,<o:p></o:p></pre><pre style='background:white'> bpinfo.interval_lock,<o:p></o:p></pre><pre style='background:white'> bpinfo.interval_notify,<o:p></o:p></pre><pre style='background:white'> bpinfo.fraud_use_reseller_rates as use_reseller_rates<o:p></o:p></pre><pre style='background:white'>FROM (<o:p></o:p></pre><pre style='background:white'> SELECT <a href="http://c.id/"><span style='color:#FF2600'>c.id</span></a>, n.reseller_id, bp.fraud_use_reseller_rates, i.interval,<o:p></o:p></pre><pre style='background:white'> IF (i.interval = 'month',<o:p></o:p></pre><pre style='background:white'> IF (cfp.fraud_interval_limit > 0,<o:p></o:p></pre><pre style='background:white'> 'account_limit', 'profile_limit'),<o:p></o:p></pre><pre style='background:white'> IF (cfp.fraud_daily_limit > 0,<o:p></o:p></pre><pre style='background:white'> 'account_limit', 'profile_limit')<o:p></o:p></pre><pre style='background:white'> ) AS type,<o:p></o:p></pre><pre style='background:white'> IF (i.interval = 'month',<o:p></o:p></pre><pre style='background:white'> IF (cfp.fraud_interval_limit > 0,<o:p></o:p></pre><pre style='background:white'> cfp.fraud_interval_limit, bp.fraud_interval_limit),<o:p></o:p></pre><pre style='background:white'> IF (cfp.fraud_daily_limit > 0,<o:p></o:p></pre><pre style='background:white'> cfp.fraud_daily_limit, bp.fraud_daily_limit)<o:p></o:p></pre><pre style='background:white'> ) AS interval_limit,<o:p></o:p></pre><pre style='background:white'> IF (i.interval = 'month',<o:p></o:p></pre><pre style='background:white'> IF (cfp.fraud_interval_limit > 0,<o:p></o:p></pre><pre style='background:white'> cfp.fraud_interval_lock, bp.fraud_interval_lock),<o:p></o:p></pre><pre style='background:white'> IF (cfp.fraud_daily_limit > 0,<o:p></o:p></pre><pre style='background:white'> cfp.fraud_daily_lock, bp.fraud_daily_lock)<o:p></o:p></pre><pre style='background:white'> ) AS interval_lock,<o:p></o:p></pre><pre style='background:white'> IF (i.interval = 'month',<o:p></o:p></pre><pre style='background:white'> IF (cfp.fraud_interval_limit > 0,<o:p></o:p></pre><pre style='background:white'> cfp.fraud_interval_notify, bp.fraud_interval_notify),<o:p></o:p></pre><pre style='background:white'> IF (cfp.fraud_daily_limit > 0,<o:p></o:p></pre><pre style='background:white'> cfp.fraud_daily_notify, bp.fraud_daily_notify)<o:p></o:p></pre><pre style='background:white'> ) AS interval_notify<o:p></o:p></pre><pre style='background:white'> FROM (SELECT IF("day" = 'month','month','day') AS 'interval') i,<o:p></o:p></pre><pre style='background:white'> billing.contracts c<o:p></o:p></pre><pre style='background:white'> INNER JOIN (<o:p></o:p></pre><pre style='background:white'> select <a href="http://ca.id/"><span style='color:#FF2600'>ca.id</span></a> as contract_id,<o:p></o:p></pre><pre style='background:white'> (select <a href="http://bma.id/"><span style='color:#FF2600'>bma.id</span></a> from billing.billing_mappings bma where<o:p></o:p></pre><pre style='background:white'> bma.contract_id=<a href="http://ca.id/"><span style='color:#FF2600'>ca.id</span></a> and<o:p></o:p></pre><pre style='background:white'> (bma.end_date >= NOW() OR bma.end_date IS NULL) <o:p></o:p></pre><pre style='background:white'> AND (bma.start_date <= NOW() OR bma.start_date IS NULL) order<o:p></o:p></pre><pre style='background:white'> by bma.start_date desc, <a href="http://bma.id/"><span style='color:#FF2600'>bma.id</span></a> desc limit 1) as id from<o:p></o:p></pre><pre style='background:white'> billing.contracts ca<o:p></o:p></pre><pre style='background:white'> ) AS bm_actual ON bm_actual.contract_id = <a href="http://c.id/"><span style='color:#FF2600'>c.id</span></a><o:p></o:p></pre><pre style='background:white'> JOIN billing.billing_mappings bm ON <a href="http://bm.id/"><span style='color:#FF2600'>bm.id</span></a> = <a href="http://bm_actual.id/"><span style='color:#FF2600'>bm_actual.id</span></a><o:p></o:p></pre><pre style='background:white'> JOIN billing.billing_profiles bp ON <a href="http://bp.id/"><span style='color:#FF2600'>bp.id</span></a> = bm.billing_profile_id<o:p></o:p></pre><pre style='background:white'> JOIN billing.contacts n ON <a href="http://n.id/"><span style='color:#FF2600'>n.id</span></a> = c.contact_id<o:p></o:p></pre><pre style='background:white'> JOIN billing.resellers r ON <a href="http://r.id/"><span style='color:#FF2600'>r.id</span></a> = n.reseller_id<o:p></o:p></pre><pre style='background:white'> LEFT JOIN billing.contract_fraud_preferences cfp <o:p></o:p></pre><pre style='background:white'> ON cfp.contract_id = <a href="http://c.id/"><span style='color:#FF2600'>c.id</span></a><o:p></o:p></pre><pre style='background:white'> WHERE c.status = 'active'<o:p></o:p></pre><pre style='background:white'> HAVING interval_limit > 0<o:p></o:p></pre><pre style='background:white'>) AS bpinfo<o:p></o:p></pre><pre style='background:white'>JOIN accounting.cdr ON cdr.source_account_id = <a href="http://bpinfo.id/"><span style='color:#FF2600'>bpinfo.id</span></a><o:p></o:p></pre><pre style='background:white'>WHERE CASE WHEN bpinfo.interval = 'month'<o:p></o:p></pre><pre style='background:white'> THEN cdr.start_time<o:p></o:p></pre><pre style='background:white'> BETWEEN UNIX_TIMESTAMP(DATE_FORMAT(NOW(), '%Y-%m-01 00:00:00'))<o:p></o:p></pre><pre style='background:white'> AND UNIX_TIMESTAMP(DATE_FORMAT(NOW() + INTERVAL 1 MONTH,<o:p></o:p></pre><pre style='background:white'> '%Y-%m-01 00:00:00'))-1<o:p></o:p></pre><pre style='background:white'> ELSE cdr.start_time<o:p></o:p></pre><pre style='background:white'> BETWEEN UNIX_TIMESTAMP(DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00'))<o:p></o:p></pre><pre style='background:white'> AND UNIX_TIMESTAMP(DATE_FORMAT(NOW() + INTERVAL 1 DAY,<o:p></o:p></pre><pre style='background:white'> '%Y-%m-%d 00:00:00'))-1<o:p></o:p></pre><pre style='background:white'> END<o:p></o:p></pre><pre style='background:white'>GROUP BY <a href="http://bpinfo.id/"><span style='color:#FF2600'>bpinfo.id</span></a><o:p></o:p></pre><pre style='background:white'>HAVING interval_cost >= interval_limit;<o:p></o:p></pre><pre style='background:white'><o:p> </o:p></pre><pre style='background:white'><o:p> </o:p></pre><pre style='background:white'><o:p> </o:p></pre><pre style='background:white'><o:p> </o:p></pre><pre style='background:white'>thanks®ards,<o:p></o:p></pre><pre style='background:white'>rene<o:p></o:p></pre><pre style='background:white'><o:p> </o:p></pre></blockquote><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'><br style='font-variant-caps: normal;text-align:start;-webkit-text-stroke-width: 0px;word-spacing:0px'><br></span><o:p></o:p></p><div><p class=MsoNormal style='background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>--<span class=apple-converted-space> </span><o:p></o:p></span></p><p class=firma style='background:white'><span class=nombre><span style='font-size:13.5pt;font-family:"Helvetica",sans-serif;color:#618094'>Alejandro Grijalba Martínez</span></span><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#618094'><br></span><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#666666'>Departamento de Sistemas</span><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#618094'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'><firma_correo.png><o:p></o:p></span></p><p class=MsoNormal style='background:white'><span class=letra><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#FF2600'>E</span></span><span class=apple-converted-space><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'> </span></span><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'><a href="mailto:agrijalba@innovasur.com"><span style='color:#FF2600'>agrijalba@innovasur.com</span></a><br><span class=letra><span style='color:#FF2600'>D</span></span><span class=apple-converted-space> </span>Calle Sierra Morena 12 A Edif.CTSAII. Pta. 2º, Oficina 9. 23620 Mengíbar (Jaén) / España.<span class=apple-converted-space> </span><br><span class=letra><span style='color:#FF2600'>T</span></span><span class=apple-converted-space> </span><a href="tel:+34953267919"><span style='color:#FF2600'>+34 953 267 919</span></a><br><br><span class=letra><span style='color:#FF2600'><a href="http://www.innovasur.com/"><span style='color:#FF2600'>www.innovasur.com</span></a></span></span><o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;background:white'>_______________________________________________</span><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'><br><span style='background:white'>Spce-user mailing list</span><br></span><a href="mailto:Spce-user@lists.sipwise.com"><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#FF2600;background:white'>Spce-user@lists.sipwise.com</span></a><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'><br></span><a href="https://lists.sipwise.com/listinfo/spce-user"><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#FF2600;background:white'>https://lists.sipwise.com/listinfo/spce-user</span></a><o:p></o:p></p></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>