One of the strange ways that SQL + Psychology has come into play in my life is through analogies that help me process things I’m going through. One major shift happened for me when I used the analogy of “Rolling Back the Transaction” to let go of the idea that I could undo some past trauma. Let me explain.
As a child, there was trauma I experienced which impacted me greatly. That’s all the detail I’m evolved enough to share at this point. However, the details are actually completely irrelevant. What is important here… is that I believed that there was a version of me that never existed, but could have existed, had the trauma never happened. That version of me had her shit together. That version of me made better choices. She didn’t need external validation (constantly). She was magic and shat rainbows.
I called her “Possible Me.” I believed she could exist if only I could “undo” the damage the trauma had caused. And thus began a campaign of fixing “Broken Me.” I’d read any self-help book I could find…I spend tens of thousands of dollars (and a lot of years) in therapy.
Currently, my extremely good therapist and I have been working through a lot of this stuff, but mostly focusing on “accepting” that I can’t undo the past. This is a lot harder than it sounds. Seriously. Meanwhile, real life continues, and every day I still get up and go to my job as a database administrator. That saying about everyone is fighting a battle you can’t see is so fucking real. You have no idea. But I digress.
One day at work, we were troubleshooting a long-running, high-CPU query. My boss and I were having the standard discussion.
Him: “What are our options?”
Me: “Wait for it to commit, kill/roll it back, or restart the instance (which might result in it rolling forward, then back again, so I don’t recommend this).”
Him: “Is there any way to undo it?”
Me: “Time machine.”
He laughed, but at that moment, the universal truth hit my gut like a ton of bricks. My trauma was a high-cpu, long-running transaction…eating up all my resources for years. “Undoing” the transaction was never going to happen (until that time machine gets invented – hurry up, Marty McFly!). The sooner I (and my boss) accepted this reality, the sooner we could actually entertain the options we had. I (up to that point) had kept looking for the magic pill (or EMDR, or talk therapy, or book, or meditation, or…), that would erase the trauma for good, so Possible, Perfect Me could come into existence.
Now, in SQL, when a Tx comes from an app, we don’t have this level of flexibility I’m about to describe, but, for my trauma scenario, I had, essentially, three options:
Let the transaction keep running indefinitely.
Commit the transaction and move on.
Kill and Roll the transaction back, if possible, which might also be indefinite.
For several weeks, I actually clung to the idea that I needed to find a way to “Roll back this transaction.” I felt like I had found the answer.
It also dawned on me during this period of processing this analogy, unlike in troubleshooting rogue SQL queries from an application, this was more like troubleshooting a bad sql query coming from my own laptop. When the query is coming from SSMS on your own laptop, you can stop the query (same as kill/rollback), you could commit the transaction (assuming you used Begin Trans…)…you have the control.
This was a “The call is coming from inside the house…” Kind of moment for me.
I’m the one letting the query stay running. I’m the one letting it keep resources tied up. All the trauma happened many years ago, is over, and now the transaction is just sitting open, waiting for who knows what. All the table locks still in place, though.
Imagine the “executing…” Down at the bottom of SSMS…and I’m sitting there going, “WHY Won’t this fucking wrap up???”
Oh yeah. No commit statement.
I could rollback the transaction, yes, but who knows how long that would take to complete. As we say, possibly as long as it’s been running. So the rest of my life. Or I could commit it and get my resources back.
Holy Shit, again.
Unfortunately, this story doesn’t have a fantastic ending, as I’m currently in the process of figuring out what “committing the transaction” means in this scenario. I will say, I oddly had a LOT of resistance to doing so. First, I thought it was death to Possible Me. Second, I ACTUALLY thought, “I’ll lose my excuse for staying small.” How fucked up is that? But it’s a real thing. When I commit the transaction, and get back all my resources…if I still don’t soar…the trauma wasn’t holding me back…I just wasn’t an eagle after all. I have to be ok with that.
Later I had some other realizations around maybe the only path to Possible Me is through this trauma/bad query. That the version of me who is so freaking amazing and badass and has her shit together could only exist because she went through this, figured it out, and came out the other side to share the journey. Maybe that’s true. Maybe it isn’t. Maybe if I had the idyllic childhood I should have, I’d have been a spoiled, racist, horrible person.
Perhaps that’s part of the lesson, too. If this bad query didn’t hog all the resources, maybe something else (maybe worse) would have resulted. We don’t know; we can’t know. And we need to be ok with not knowing (I’m not there, yet).