DEV Community


How to debug SQL Databases

Leonardo Gasparini Romão
Trabalhando com programação desde 2012, desenvolvedor ASP.NET
Updated on ・3 min read

This post was part of a series talking about How to create a good architecture for SQL Databases:

First, we set up an environment for database version control, then we work on creating a new framework to organize the code we created on the server, now let's talk about another feature that we can use in our databases to us Help, debugging.

Debugging in Database

That part was weird to me because I've never seen anyone debug in a database for the obvious reason: The debug mode is much less performative. But, debug is a tool that most programmers do not live without now, and I think I could not solve 90% of problems with programming if I had not debug. A Microsoft article explains very well the walkthrough to have this feature on your SQL servers.

So, how to bring such an important resource to databases without compromising performance?

Strategy: Prepare multiple environments


Separate development environments when we talk about systems, companies already adopt the idea of having development, homologation and production environments. These environments allow us to make a transition from new functionalities in a less problematic way, even though the deliveries are somewhat bureaucratizing. With the development environment, we can work freely in the debug of apology currencies and jobs quietly, only this will already help a lot the work of scheduling new features and doing maintenance on possible bugs. An article in
Medium explains this process very well.

Synchronize production data with the development

It Is important to remember that we need the data updated with the development environment if we always want to have the best real proof of new functionality or the errors our base may be experiencing. This synchronization can be instantaneous or scheduled but if possible have it prepared.

Adding another database to my infrastructure can be very expensive

Nowadays, robust databases do not have a few bytes of information, on the contrary, the largest technology companies are playing with PETA bytes of data, making transfers and analyses in real-time and massively. With our current scenario, having disk space in a robust infrastructure to develop software, it can be very expensive, even more, if we want to have environments as close to production as possible. But the local infrastructure to work with the database is becoming something much cheaper as it spends the years. Open-source infrastructure, storage, and data processing Solutions are increasingly appearing in the world. Database-specific cloud computing Solutions then dropping to the public's liking so enabling you to work with more resources. So spend some time analyzing how to align the cost of your infrastructure so you have multiple environments.

These suggestions, plus the other parts of this article, you will have a much more robust and prepared environment for the organization routine, less prone to failure and more organized.

Discussion (0)