0

I’m making a database where people book an appointment with doctors.

The problem I’m facing is how to make a timeslot table for the doctors to choose the time they’re free without wasting storage.

The solution I have right now is making a timeslot table where doctors fill the days and hours they’re free, which leads to a lot of unused data (due to people not booking them).

On another note, should I make a timeslot_id and populate the booking table with it? Or what’s the best way to implement that?

Binosaimi
  • 1
  • 1
  • What exactly are you concerned about in terms of storage…?! You do need to store the times when doctors are available *somewhere*… How many gigabytes are you realistically going to "waste" with this? – deceze Oct 07 '19 at 07:42
  • My concern is if there are better ways to do this? – Binosaimi Oct 07 '19 at 07:49
  • 1
    That depends on many things, for example the complexity of your queries, or how else exactly you want to figure out whether free slots exist or how to confirm a reservation. I had a pretty complex free-slot-reservation system where the matching of free slots to reservations depends on skill sets, and ended up handling it in memory with [an interval tree and some complex code](https://stackoverflow.com/q/44589798/476); so the database storage format wasn't all that important. – deceze Oct 07 '19 at 08:13

0 Answers0