Optimize some SQL table and Models