r/SQLServer • u/mssqldbalearn • Apr 11 '26
Discussion “I’m trying to improve my SQL Server skills—could you share one important concept or trick that helped you in real projects?”
8
Upvotes
r/SQLServer • u/mssqldbalearn • Apr 11 '26
•
u/AutoModerator Apr 11 '26
After your question has been solved /u/mssqldbalearn, please reply to the helpful user's comment with the phrase "Solution verified".
This will not only award a point to the contributor for their assistance but also update the post's flair to "Solved".
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
14
u/Grogg2000 Apr 11 '26
dbatools, an everyday saver.
40
u/Maximum_Honey2205 Apr 11 '26
Learn and understand indexing efficiently and query plans.
19
u/InternDBA Apr 11 '26
don’t restart an instance while waiting for a query to rollback.
7
u/perry147 Apr 11 '26
6
u/60SecTheBaptist Apr 11 '26
Learn how to use the sql server native tools. SSMS, extended events, profiler (deprecated but still useful), Sqlcmd, BCP, SSIS, SSRS, database scripting. Dbcopy tool, import export tool, etc.
3rd party stuff is helpful but what if you don't have it? The instance mostly comes with all those tools for free and sometimes those 3rd party tools don't work for some unexplained reason and you need an alternative tool.
Case in point, I had to take a backup in a very sensitive and locked-down area of our network. Couldn't get litespeed to install... Native backup with compression and file striping saved the day.
5
u/tumor_0 Apr 12 '26
Brent Ozar and the first responder kit accelerated my DBA skills so much. Also paid for access to his courses.
Mainly learning how to performance tune and identity issues. Index and query plan analysis.
7
u/k_marts Apr 11 '26
Get good at query and index tuning
Learn how to read query plans
Become intimately familiar with wait types
Understand that in SQL Server there are usually multiple ways to solve for something
3
u/LredF Apr 11 '26
For the love of God use variables and name them well. I despise the 3-4 function long logic and when they get it right, they copy paste it.
3
u/KickAltruistic7740 Apr 12 '26
Whenever you modify anything check it twice and then check it again. The amount of times i have seen senior DBA’s for example reschedule a job incorrectly is astounding.
3
u/butchcoleslaw Apr 12 '26
Whenever you perform a potentially destructive query (DELETE, UPDATE, INSERT) for a lot of data, the first time you "test" the query, wrap it in a BEGIN TRAN and ROLLBACK to make sure it works as expected. When you're certain the results are what you need, then you can run the query without the guardrails, or just change the ROLLBACK to COMMIT.
4
u/kagato87 Apr 12 '26
Yea, no matter how much you understand, there's always an unseen pit over yonder. It will never behave the way you expect. The best solution is the best solution, until it isn't.
Wall time is a useless measurement. So many things affect it. CPU utilization is a poor measure of how busy your server is. Disk IO doesn't tell you much of anything. RAM utilization under 90% just means your whole database fit into memory. SQL engines like to use it all.
If you're doing A/B testing, use logical reads, memory grants, and cpu time as your metrics. If you must measure time, learn the commands for your platform to dump the cache (for example: checkpoint, dropclean, and freeproccache).
Ok, that out of the way.
Readability is king. It's easier to fix readable code. That measn meaningful aliases and generous space of newlines and whitesplace. (I'm a fan of "one column per line" in the select and group by, for example.)
Learn the CTE. Most cases they're functionally identical to a subquery, except they're about a million times easier to read.
Be wary of the correlated subquery. They are dangerous. (That's where the subquery references a fact column.) Sometimes they're a good fit, sometimes they make things go boom.
Be VERY mindful of cardinality in your joins - make certain the 1 side of any join is actually 1. Especially if you'll be aggregating.
Learn to love the semi join. You'll thank yourself when you start dealing with larger datasets.
1
u/WeirdImagination2439 Apr 12 '26
This is a soft skill that leads into tech skills. One thing that helped me is getting to know more of your coworkers. This won't work in every industry but I'm fortunate enough to work at a small college where everyone is really friendly with each other. One thing I always tried to do is make everyone I exist and that I'm there to help where I can. I tell them if they notice a workflow that's too manual, let me know and we will work together to hopefully speed it up. You'll eventually get all types of projects and you'll fix areas where the system is lacking all the while making new friends :).
1
u/delsystem32exe Apr 13 '26
become the server.
1
u/hyou91 Apr 13 '26
For me the most important skills those change my life when I start using Stored procedures, views and SQL jobs.
And consider learning loops with CURSOR to use it inside Stored procedures.
Good luck
1
u/EmbarrassedRip6366 Apr 15 '26
Focus on basic SQL including 1) SELECT 2) JOIN statement 3) Built-In SQL functions
1
u/CPDRAGMEISH Apr 20 '26
IT'S OK
Basic Things