Dreaming in MySQL

Jan 2014

(Based on a Dream)

 

“There are only two hard problems in computer science: cache invalidation and naming things.”

– Phil Karlton

 

“Computing should be taught as a rigorous – but fun – discipline covering topics like programming, database structures, and algorithms. That doesn’t have to be boring.”

– Geoff Mulgan

 

I’m sitting in a long exam hall. There are chairs and desks everywhere arranged in columns and rows. To my left is what seems like thousands of tables. Same to my right and behind me. It’s impossible to tell how long it they go for or how many tables there are because they seem to go on forever.

It seems endless. Sitting at each table is a student. There are thousands of students sitting there and each is writing furiously trying to complete their exam. Each student looks different. But it’s like their differences are highlighted and stand out. But each difference falls under a bigger category that in real life you don’t pay attention to. The same way you can break down each person into the make up of their parts. Everyone has a face and a nose and wears clothes.

Normally you don’t pay attention to this. But you notice it here. Each one is wearing shoes. Each shoe has laces. But every shoe is different. Their type of shoe falls under the broader category of shoe and so on and so on.

I stand up from my chair and look around the room, watching everyone. They don’t seem to notice me. I’ve been tasked with trying to make the room more efficient, in a way only dream logic can explain. I start walking around looking for ways to optimize the exam hall. I realise I’m in a database. It’s a MySQL database.

I see an older gentleman wearing a grey suit. He’s not really paying attention to the exam. He’s clearly not supposed to be here because this table is for students and he isn’t one. He belongs in another section.

I ask him to stand up and move to a different table in a different section. As I do this, I feel like an SQL query has just been executed. But I can feel it executing as the guy stands up. And as he walks and sits at his new table another one does. This is crazy because I could have sworn I had a conversation with the gentleman but also felt the entire interaction take place in SQL. I don’t even know if it was correct. This happens for everything.

I walk around a bit more and do the same thing to a few other people. Talking to them doesn’t actually take place but it seems like it does. I look around the hall. Geez this is a big hall. It just goes on forever. Why is it even this large? Surely we could have used a smaller hall.

I suddenly have a clipboard. On the clipboard is an explanation of how the rows and columns work. It seems bizarre. There is a shoe column and a laces column for people with shoes and then those with and without laces.

There is a girl sitting there. Her name is Valerie. I don’t really know anything about her. But she’s different. She’s wearing a dress. It’s flowery and purple. Apart from that she’s the same. She’s a student so belongs in this section. But that one change means her data is no longer able to be accurately stored in the current schema. Because of that she’s not writing the exam. She’s not even trying. Which means she’s sitting in the wrong place.

But I’m still not sure where she should go. I think about maybe rearranging the tables around her or creating a new table just for her. But there aren’t many other people wearing dresses let alone girls wearing dresses who are also not wearing shoes and I don’t know where it would go anyway.

She starts arguing with me that she is in the right place I’ve just screwed up the way her data was inserted. I don’t really understand what she’s talking about and don’t think she does either. Should I just delete her row? It probably won’t have much of a difference on the exam at large. Or any of the other students. But that seems like a wrong decisions. She’s kind of pretty and I don’t really want to delete her.

Then it hits me. She’s not wearing shoes. Why is she being stored as multiple data types. Why not just convert her into an array and store her in the same place. Then the whole not having shoes thing won’t matter. In fact why are we storing shoes as shoes? And laces as laces?

Why don’t we just store all the laces under shoes. In fact why are we storing each thing as a separate column. Why don’t we just convert all the aspects of a student as an array and store them as a student array. It would cut down so much unnecessary walking for me. As I think of it this seems to happen and now there are a whole lot less rows and columns than when I started walking around.

She’s now an array but I still can’t figure out where she goes. Why are we storing each person as an array anyway? I know I just did that but that’s not really how people work. The person should be an array of all their aspects and then a multidimensional array should denote the actual aspects themselves. That makes way more sense.

I also explain to her that benefits of education and she starts writing the exam. Which means she’s now in the right spot, in the right format, where she belongs. I hope she gets a good mark.

Advertisements