Try to workaround sql lock problem, improve the performance