could this query be added to the transaction used later to insert the new log ? that way there are no sync queries and the caller threads doesn't need to wait.