Adds UNIQUE constraint to table, runs persist stats in background to prevent blocking UI thread