On Friday, February 25, 2011 4:25:00 PM UTC-5, DenesL wrote: 
>
>
> The problem is checking against all dates already in the DB. 
> To avoid that I would have another table with the max(to_dates) and 
> min(from_dates) of all DB values, those will be updated with each new 
> insert if required. 
>
> Why those values? to avoid any overlaps, then your new values must be 
> such that 
> to_date < min(from_dates) and from_date > max(to_dates)

 
Doesn't this just ensure that the new range is entirely before the earliest 
or after the latest existing range? What if you want to insert a range that 
fills a gap within the existing set of ranges -- wouldn't you have to 
compare against all the existing records in that case?
 
Anthony

Reply via email to