<div dir="ltr"><div>Hello, </div><div>I am planning to enable acc cdr in my kamailio 4.1 server.</div><div>I am testing in my lab and it is working fine.</div><div>However, when I check the table definition I see this:</div><div><br></div><div><div>mysql> describe acc_cdrs;</div><div>+------------+------------------+------+-----+---------+----------------+</div><div>| Field      | Type             | Null | Key | Default | Extra          |</div><div>+------------+------------------+------+-----+---------+----------------+</div><div>| id         | int(10) unsigned | NO   | PRI | NULL    | auto_increment |</div><div>| start_time | varchar(32)      | NO   | MUL |         |                |</div><div>| end_time   | varchar(32)      | NO   |     |         |                |</div><div>| duration   | varchar(32)      | NO   |     |         |                |</div><div>+------------+------------------+------+-----+---------+----------------+</div><div>4 rows in set (0.00 sec)</div><div><br></div><div><br></div><div>The *_time and duration columns are defined as varchar.</div></div><div>Because of this, i need to perform a cast when doing queries:</div><div>  select * from acc_cdrs where cast(start_time as unsigned) >= 1437120622;</div><div>which would cause extra processing in the db server.</div><div><br></div><div>So I experimented changing these columns to "int unsigned" and to "float unsigned" and it worked for both without problems (records properly added to acc_cdrs and no errors in kamailio.log):</div><div><br></div><div><div>alter table acc_cdrs modify start_time int unsigned;</div><div>alter table acc_cdrs modify end_time int unsigned;</div><div>alter table acc_cdrs modify duration int unsigned;</div><div><br></div><div>alter table acc_cdrs modify start_time float unsigned;</div><div>alter table acc_cdrs modify end_time float unsigned;</div><div>alter table acc_cdrs modify duration float unsigned;</div></div><div><br></div><div>So I am thinking in doing this in my production server but I would like to know if there is any potential risk of doing this (as I am not sure why it was decided for these fields to be varchar instead of a numeric type).<br></div><div><br></div><div>Regards,</div><div>Takeshi</div></div>