db, comparison, ranges: improve how comparisons will be stored in the db