improved SQL table sync