So I have this MySql table which stores all the prices that a product had trough the year, and I want to be able to change the prices by adding a new date. The values in the table are already all merged so I don't need to check whether or not they are correct, I just need to be able to figure out where I need to put the new date.
The setup of the table is along the lines of:
| Initial Date | Final Date | Price |
Since MySql doesn't have a way to represent Date Intervals ( That I know of, and we are on MySql 5.7 and cannot change that ) we are representing it that way.
A more visual example would be this:
And then imagine I want to add a new Date Interval, (2019-03-03 | 2019-03-10 | 9$), and then the table would look like:
This is just one example of a collision, but obviously there can be a few cases, including not even having any collisions for example.
I made it work, but the problem is, it's taking very long, around 5 min for 1200 new date intervals. And the problem is that I can't even figure out whether that is a lot or not, because I don't have anything else to base myself off, since searching for it on google yields pretty much no results specific for this type of merging...
If anyone could help me out a bit, even just by saying whether or not my time should be relatively okay for the type of stuff I'm doing...
I am using MySql 5.7 and java for this work, and the dates are read from a Excel File.