Databases Are Like Walk-In Coolers. #tsql2sday

In the back of a restaurant, there’s a walk-in cooler (or a few of ’em.)

When a chef needs to make something, she goes into the walk-in cooler, gathers the necessary ingredients, and then comes out to the kitchen to do the cooking.

She doesn’t cook inside the walk-in – that wouldn’t be efficient. She just gets her ingredients and then does her work elsewhere. The fridge isn’t a place for work to be done: it’s just for ingredient storage.

She makes as few trips into the fridge as practical in order to prepare her dishes. At the start of her shift, she’ll fetch enough ingredients to prepare several servings of something – she wouldn’t dream of making a separate trip to the fridge for each and every salad plate she needs to make. (She might even prepare several salads at once, and then keep them nearby for orders.)

When the walk-in fridge goes down,
the chef calls a fridge tech.

When the walk-in is broken, the chef is the first person to notice – but she isn’t the person to repair the fridge. She calls a separate person in, a refrigeration technician. That fridge tech might indeed know how to cook, but that’s not his job in this scenario, and nobody’s paying him to cook stuff. His job here is just to fix the fridge to get it to cool the room appropriately.

If the fridge tech arrives onsite for a support call to fix a fridge that won’t stay cold, and if he notices that she’s leaving the door propped open all the time, he’ll have a quick talk with the chef. He might say, “Listen, the fridge you bought simply isn’t powerful enough to accommodate leaving the door open, or trying to run a deep fryer inside the fridge. You’re going to have to make a compromise: either do your cooking out on the line, or buy a bigger fridge, or start closing the door.”

Small restaurants don’t need a full time fridge tech. They might even just call the fridge manufacturer for warranty service. However, as restaurants grow into chains, or their sales become large enough to warrant it, they might hire a general handyman. That jack-of-all-trades will fix fridges, air conditioners, stoves, blenders, you name it – whatever breaks, they’ll do a good-enough job to fix most restaurant technology problems. Restaurants (or restaurant groups) have to become pretty big before they can justify hiring their own full time refrigeration technician.

Proactive restaurants will bring in a refrigeration technician on a regular basis to do a check-up. The tech can do maintenance to make sure the existing gear lasts as long as possible, and also warn when it’s approaching end of life, and time to think about a more efficient model.

Database server = fridge.
Chef = developer.
DBA = refrigeration tech.

If you use the database server to generate HTML, for example, you’re trying to cook inside the fridge.

If you run a query for every row you need to render on a web page, you’re making too many trips to the fridge.

If you begin a transaction and leave it open while you work, you’re leaving the door propped open.

If you host a 1TB data warehouse on 16GB RAM, you’re trying to run a highway-side McDonald’s with a dorm room fridge.

As your DBA/fridge tech, my job is to make sure you’ve got the right size fridge for your needs, help you understand the best ways to use it, and warn you when you’re using it inappropriately. I won’t tell you how to cook – sure, I can bang out a query, but that’s not really what you wanna pay me to do.

The cloud is like
renting a strip mall restaurant.

At first, it seems like putting your database in the cloud is like renting space in someone else’s fridge. Nobody in their right mind would do that: the latency would be unworkable. You can’t go to somebody else’s building and open their fridge every time you want to make an omelette.

But you don’t rent just the fridge.

You rent an entire restaurant space.

Strip mall owners have already set up generic space that works well enough for most kinds of restaurants – burgers, pasta, Chinese food – and you can rent a space from them for a monthly fee. They’ve already got walk-in coolers, stoves, deep fryers, cash registers, booths, and most commonly required restaurant gear.

Sure, you don’t get as much flexibility – you can’t lay out the restaurant exactly the way you want. However, if you’re starting out a new restaurant, and as long as you’re not aiming for something really unusual like conveyor-belt tank-to-table sushi, it’s probably good enough for you. (And yeah, there’s still a fridge tech, because sadly, the strip mall landlord just deposits your rent and doesn’t answer your phone calls.)

If you liked this, you’ll probably like the other entries for this week’s T-SQL Tuesday hosted by Rob Volk. Scroll down to the comments to see today’s entries, or read tweets tagged #sql2sday.

Previous Post
Free Live Fundamentals Classes, Registration Open Now
Next Post
Free Webcast on Thursday: Avoiding Deadlocks with Query Tuning

10 Comments. Leave new

  • So in this analogy, are applications that don’t have a database backend restaurants that only serve those freeze dried pouch meals with boiling water?

    Reply
  • Love this . . . very well done. Now I’m imaging walk-in interior designs with the shelving unit blocking your path, and the heavy bags on the top shelf and strawberries under the onions . . . and a heated conversation between the chef and the fridge tech as the chef tries to rearrange the walk-in and the fridge tech has a fit. 🙂

    Reply
  • After spending a number of years (I won’t say how many) in the restaurant business before becoming a DBA, this post strikes a resounding chord with me! I’m a little embarrassed that I didn’t think of it first, But then with Brent being a gourmand, it makes perfect sense! and to Joe Mama, no, the applications without a database backend are the “customers” out front that think they should be able to order any dish, in any restaurant and have it presented to them perfectly in less than 10 minutes and only pay the dollar menu price!

    Reply
  • Great, now I want tank-to-table conveyor belt sushi!

    Reply
  • As a developer, I am guilty of cooking in the freezer (because all of the different cooks go to the same freezer). Working on getting them to stop off at the sous chef before going to the freezer.

    Reply
  • Isn’t some cooking allowed? Like stored procedures doing work and returning results rather than the front end bringing all the data needed for calculations across the network and doing the work in the front end? Or would that be considered prep? 🙂

    I worked at a place where the developers had never even heard of stored procedures. The database was a big garbage can of data for all they knew. They learned to use sprocs, though, one even got good enough to write dynamic sql!

    Reply
  • Todd Chittenden
    October 13, 2020 1:21 pm

    I took Microsoft tests for Certified SQL Server DBA several years back. Several of the questions were along the lines of “You’re developing a web page to do such and such, what type of code object should you use to get data from the SQL database?”

    That’s like asking the fridge technician if the 15 pounds of raw fish should be transported to the kitchen in a bowl, or a deep-dish tray.

    Sadly, Microsoft test authors don’t know the difference between a cook and a fridge technician!

    Reply
  • Thats why the company i worked for sucked.We did not have refregirator.They only served hot dogs (we used cassandra) LOl

    Reply
  • Very good analogy and witty too.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu
{"cart_token":"","hash":"","cart_data":""}