We would all be happy if tables in our databases only contained the data we need. In reality, we tend to have data that needs kept for legal purposes or “just in case” something happens. Are you querying a table where queries only care about a fraction of the data? When optimizing a query that … Continue reading What About Filtered Indexes?
When we query for data, we don’t always think about the magic that goes into efficiently returning results. One vital piece to this magic is statistics. Statistics in SQL Server are histograms that are used by the query optimizer to determine an optimal execution plan when executing a query. Let’s take a look at the … Continue reading Auto Create Statistics – Do the Stats Tell the Story?
Let’s imagine a scenario. It’s one that I’ve been through and I suspect it’s one that some reading this post have been through as well. You come in on Monday morning feeling good after a relaxing weekend. You check your e-mail and have an alert about a job that failed the previous Friday night. Because … Continue reading Save Enough Job History Before It’s Too Late
The invitation for the October edition of T-SQL Tuesday comes from John McCormack. John wants to know the best “go to handy short scripts” to have in your arsenal, whether it be T-SQL or other languages. Click on the image below to check out the full invitation blog post: SQL Server Version Check The most … Continue reading T-SQL Tuesday #143 – Handy Short Scripts
As I was browsing the internet last week, I stumbled across this post on Reddit highlighting the five official time zones of Australia: As someone who has had to deal with comparatively easy one hour time zone increments in the United States, this image made me cringe. The comments in the post made me aware … Continue reading The Mystery of Australian Time
What happens if you have a SQL Server that was initially built and licensed for a heavier load than what currently exists? Maybe the databases on the server have been optimized to no longer require as much power. Perhaps for one reason or another the busiest databases have been moved to other servers. If you … Continue reading Licensing SQL Server and Affinity Masking
In my last post, we created a DACPAC in SSMS. Now, it’s time to use that DACPAC to create a new database and update an existing database. Brand Spanking New What if we want to use our DACPAC to create a new database using SSMS? Our first step will be to right click on Databases … Continue reading Deploying a DACPAC
How are you deploying updates to your databases? Do you run a SQL script that you receive from developers? Maybe you have a SQL job that takes a script stored at a specified location and applies it to all user databases. Another option for deploying updates that you may not be as familiar with is … Continue reading Creating DACPACs for Deployments
In my previous blog post, we saw how using INCLUDE to add a column to an index can make a difference compared to a key column. Let’s do a quick overview of INCLUDE and when it should be used. Included columns are columns that can added to an index as non-key columns. They are only … Continue reading Indexes and Included Columns
If you’re wanting to test out your query tuning skills, download a Stack Overflow database and check out https://data.stackexchange.com/stackoverflow/queries for example queries. I like to choose a random query and see how well I can optimize it. Sometimes that means adding an index. Sometimes that means rewriting the query altogether. There’s not a “right” answer … Continue reading Free Query Tuning Practice
Something went wrong. Please refresh the page and/or try again.
Follow My Blog
Get new content delivered directly to your inbox.