We have a table A with column "ETA To Destination" in minutes.
id | ETA To Dest (mins) | Score |
---|---|---|
1 | 45 | |
2 | 75 |
There is a configuration table where we have defined scores based on the time intervals.
For example - If the ETA is between 31 to 60 mins, score is 5 points, ETA is between 61 to 120 mins, score is 10 points,
From Time | To Time | Score |
---|---|---|
0 | 30 | 2 |
31 | 60 | 5 |
61 | 120 | 10 |
We need to find the score (in table A) based on the ETA minutes in the configuration table (between from and to time).
I do not want to write a full join that will do a sequential scan in the table. Is there a better alternative or a better design.
Table A can have million of records and configuration table can have few more additional time interval rows.