improved SQL table sync

Reduces sync time from 14s to 2s