CONTRIB-4852 Allow time range not to be divided into slots
CONTRIB-1698 fix uniqueness in get_records_sql