3
Lennerd
6y

In our application we now need the possibility to add visit hours to addresses. Each day has 3 possible visit moments with a from and to hour and some indicator, and a comment, like this:
monday_visit_from_1, monday_visit_to_1, monday_visit_ind_1, (repeat for 2 and 3), monday_visit_comment (repeat for all 7 days)

For "performance" they (db admin) decided to add all the fields of all the days as separate columns in the address table, 70 in total.
Besides being a horrible design it is a fucking pain to work with, like find if an address can be visited on a given day and time we need to check a subset of columns based on the day and the 3 moments in this day.

Is this really more performant than an extra table to hold the visit moments and is this something that gets done in more places?

Comments
  • 1
    Most likely no. You would have to create and query multiple indexes and while som sql servers are pretty good at using multiple indexes its unlikely it would be faster than one good index.
Add Comment