SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Start Fixing Your DB with Better Code

By Steve Jones,

I ran across an interesting article from Gitlab. They host git repositories for companies that develop software, and of course, part of their hosting is tracked in a database. They use PostgreSQL for their data, and were not happy with the performance of their database backing the system. Up front they admit part of the issue is their own coding, which is likely the problem in so many software projects.

Gitlab accepted this, and certainly many database developers or consultants will let management know that the problem causing poor performance is often poorly written code. Jeff Moden constantly explains in his articles how better code can dramatically reduce the load on your SQL Server, yet fixing code is often the one thing few organizations want to focus on. It's easier to buy more hardware, which often just hides the problem for am all-too-short period of time. Or just complain and try to write new features that take the place of old ones.

I'm sure many of you have heard your parents or teachers tell you it takes about as long to do something right as wrong, so do it right the first time. Often taking a shortcut doesn't really save time. I'm not sure that's true with development. Often it's quicker to do it wrong because doing it right takes a little more planning, and perhaps some testing, likely a bit more time to carefully construct code, and certainly more time to learn how to write code better. That last item is the issue, as so many of us learn to write code poorly, without examples that give us good habits from the start.

The best developers have spent lots of time writing code poorly and learning how to improve their work. They know the tips and tricks in their language(s) of choice. That might be better SQL to create efficient queries, better C# to avoid constantly hitting the database, or something else. However, as most of us learn to write code, we don't learn the best way. We learn the ways that are easiest to teach a user concepts, most of which don't scale well.

If you've made the investment to learn about writing better code, then it doesn't take any longer to write good code from the start. If you've made the investment, and if you practice what you've learned. Jeff has lots of great articles on writing better code, as do many of our other authors. Take a few minutes today and learn to build better SQL code. Your database (and users) will thank you.

 
Total article views: 105 | Views in the last 30 days: 1
 
Related Articles
ARTICLE

Write Better Code

Better security can be achieved by writing better code. Steve Jones agrees, but doesn't think it's a...

ARTICLE

Writing Better T-SQL: Top-Down Design May Not be the Best Choice

One of the best ways in which you can build better applications is by learning to write better T-SQL...

ARTICLE

Better Writing

Are you a good writer? You should be. Steve Jones notes that communication skills are not only impor...

FORUM

Better Writing

Comments posted to this topic are about the item [B]Better Writing[/B] It may not shine through in m...

BLOG

Tips & Tricks for DBAs Writing Their First Article

I have been writing full or part-time for nearly 30 years, and I have written and edited hundreds of...

Tags
editorial    
 
Contribute