Database changes and logs sorting