Database structure for storing different timings everyday?

Hello Bubblers :wave:

I have a table called “Shops” which stores different information of the shop (see in 1st image).
Each shop is having different timings on each day of the week.

So i created another table called as “Shop_timings” which stores the “opening” & “closing” time of every day of the week for each shop

But the problem i am facing now is

I have around 600+ registered shops & each shop is having different timings on each day
So, my “Shop_timings” table is having “4300 +” records
Is there is any way to reduce this records or any improvements can be made?

@sam.morgan @Jici @adamhholmes @cmarchan or any expert can you please help me?

3 Likes

Why? What’s wrong with doing what you’re doing? (that’s how I’d do it most likely)…

That said, if multiple shops have the same opening times (which is fairly likely if they have standard opening times like 9-5 etc.), then you can just create a predefined list of opening times (or create them on the fly as new ones are added), and just use those for each shop…

@adamhholmes Thanks for your response :slightly_smiling_face:
The problem i am facing is
When i am displaying the timings of the shop Do a search for shop_timings it is taking a some amount of time.

In future if my registered shops are 5K+ then “Shops_timings” table will have (35K+ records)
I don’t want to do any restructure at that time (Just to be on safe side i asked this question).
Will my app performance get affected & what to do at that time?

You shouldn’t need to do a search for shop_timings (and based on your screenshots of your current database setup you can’t do that anyway, as there’s no reference to the Shop on the Shop-Timing)…

Just refer directly to the Shop's Timings (that should be faster than doing a search for)

1 Like

@adamhholmes
Sorry, actually this project is in another language
I just tried to make this table in “english” with minimum fields…

So my “shop_timings” table is like this

I am showing it like this

But it displays what i need.
Am i doing anything wrong?

Thanks a lot for your help :pray:

That’s fine, but as you’ve experienced, that will be slower than doing it the way I suggested.

Yes its slow,
As records are increasing.
I Don’t know how to deal with this problem?

Thanks a lot once again for your response :pray:

As I already said, just refer directly to the current page shop’s timings, instead of doing a search for the timings (that should be faster)…

1 Like

@adamhholmes
I never realised that.
I tested it just now, it’s loading goddamn fast :rocket:

You are really an expert :tada:
Thanks :+1:

1 Like