Press "Enter" to skip to content

Author: Kevin Feasel

Key Lookup Without Output Column

Daniel Hutmacher gives us a head-scratcher:

Performance tuning the other day, I was stumped by a query plan I was looking at. Even though I had constructed a covering index, I was still getting a Key Lookup operator in my query plan. What I usually do when that happens is to check the operator’s properties to see what its output columns are, so I can include those columns in my covering index.

Here’s the interesting thing: there weren’t any output columns. What happened?

The answer makes perfect sense, and shows that looking at the SELECT clause isn’t enough.

Comments closed

Getting Physical

Denny Cherry explains the value of his having physical hardware on hand:

Now you may be asking why don’t we just do all this in Azure? And we could, but the reason we didn’t is pretty straight forward. Cost. Building tons of VMs in Azure and leaving them running for a few weeks for customers can cost a decent amount pretty quickly, even with smaller VMs. Here our cost is fixed. As long as we don’t need another power circuit (we can probably triple the number of servers before that becomes an issue) the cost is fixed. And if we need more power that’s not all that much per month to add on.

All and all, this will make a really nice resource for our customers to take advantage of, and give us a place to play with whatever we want without spending anything.

Ah, the life-long struggle between cap-x and op-x…

Comments closed

R For The Microsoft Developer

Ginger Grant has a great intro on setting up R Tools for Visual Studio:

For those people who haven’t made the decision as far as which tool to use, let me offer two compelling reasons to pick Visual Studio [VS] instead of R Studio: Intellisense and Improved Debugging Tools. R studio does not have intellisense and it is not possible to debug your code by stepping through it in the manner that many developers of VS are already quite familiar. You will need to configure VS to use R tools, which are detailed below.

Those are nice features.  I’m still a big fan of R Studio, but have seen big improvements in R Tools for Visual Studio, so I imagine I’ll make the switch by the end of the year.

Comments closed

Kitchen Sink Procedures

Aaron Bertrand discusses procedures which satisfy all potential search conditions:

This table has a lot of columns, obviously. Now envision an interface where employees at World Wide Importers could perform searches for specific customers. They may want to perform different searches based on unique combinations of criteria, including (and this is not an exhaustive list by any means, but enough for my purposes today):

  • CustomerID (e.g. pick the customer from a list);
  • actual “bill to” CustomerID;
  • name;
  • category;
  • buying group;
  • when the account was opened;
  • city; or,
  • whether the account is on credit hold.

And any combination of the above. I know you’ve seen and probably built interfaces like this before, but just as a quick mockup, the employees would have a screen something like this:

There are plenty of ways to solve this problem, and Aaron shows a couple methods (including one which has major problems).

Comments closed

Why Have A Date Dimension

Thomas LeBlanc discusses reasons for having a date dimension in a data warehouse:

The date dimension can also contain columns for Weekend versus Weekday, Holiday and month markers like 2014-10 or by quarter like 2014-Q1. All these can be computed once in the dimension table and used at will by query writers. They now do not have to know how to use T-SQL functions or concatenate substrings of “CASTed” date columns.

Then, when the DimDate is related to various Fact tables and processed into an OLAP cube, the measures and aggregations are displayable side by side through the DimDate dimension which is now considered a Conformed Dimension. The slicing and dicing of data has just been made a whole lot easier.

I’d go a step further and say that every instance should have access to a tally table and a date table.

Comments closed

Don’t Panic

Robert Davis describes how he recovered from accidentally deleting a production-necessary LUN:

That’s right, I did it. I was deleting unused LUNs and the focus somehow jumped from the LUNs for the one database onto a LUN for another database. I blame an errant mouse-click. As soon as I deleted the LUN, I realized the name was wrong. The LUN held the log file for a production database.

Fortunately for me, the database was in an Availability Group so after recreating the LUN and attaching it, I restored the database from the read-only secondary.

The biggest disservice you can do to yourself in a situation like this is to panic.  Stop, think it through, and act once you have a plan.  Even better, plan ahead:  try one of these disasters in a non-production environment and see how the team reacts, what you need to do to bring it back up, and how you can improve next time (which might be in prod).

Comments closed

Thinking Docker

Matt Smith thinks about Docker and SQL Server:

At one of my local user groups, Suffolk Devs, back in Sept 2015, Richard Vickerstaff done a talk on Docker. One of the things I took away was this was very dev friendly, Richard was honest in the fact he has yet to deploy to production in this manner and the general feedback from the room at the time was no one else had – this doesn’t mean no-one has since of course, but you start to get the feeling the DBAs back home wouldn’t be happy. The other thing was the dev nature of it, for example, when your developing, you don’t want to be held back by “rules” that protect data, it is after all, development, your not going to have production data in your dev environment, right? So, if you don’t “pin” your storage to a persistent path, it’ll get purge when you stop your docker image. Can you image if you forgot to set the production config correctly and come a reboot all your data disappears? I can already here my friendly DBA screaming.

I think that within a few years, non-Dockerized SQL Server will be considered quaint.  “You mean you had to install and configure it each time?”

Comments closed

Full-Text PDF Search

Jon Morisi shows how to use Full-Text Search to read PDF files:

Faced with this very issue, I decided to setup a local SQL Server Full-Text Search.
Some of the cool things Full-Text Search will give you, over and above, a standard search include the following:

  • One or more specific words or phrases (simple term)
  • A word or a phrase where the words begin with specified text (prefix term)
  • Inflectional forms of a specific word (generation term)
  • A word or phrase close to another word or phrase (proximity term)
  • Synonymous forms of a specific word (thesaurus)
  • Words or phrases using weighted values (weighted term)
In order to get stared with the setup, it’s important to know that the Full-Text Search architecture relies on filters for searching various file types.  This is important for this example because the PDF filter is not installed by default.  So, for starters, we need to go download and install the PDF ifilter(PDFFilter64Setup.msi).

Up until I read this blog post, I had no idea that full-text search could index PDFs, so that’s very interesting.

Comments closed

Retention Analytics

Patrick LeBlanc shows collegiate retention data using Power BI:

Partnering with Stetson University, I am happy to share the first of many Power BI Higher Education Analytics solutions. This solution shows student persistence, retention, and graduation patterns, leveraging BANNER as the data source. Year-over-over retention and graduation rates can be filtered to allow deeper examination of trends at the college and major level. Additional views, including retention and graduation rate tables by major and ethnicity, are included within the report solution.  The entire solution with documentation can be downloaded here.

The following image shows the first view within the report: overall persistence, retention, and graduation rates by year of first time student cohort. This report allows users to quickly show institutional retention and graduation trends across time, with the option to filter the view to show only specific colleges and/or majors.

This also serves as a Power BI demo, in case you’re hurting for good examples.

Comments closed

Power BI Custom Visuals Course

Devin Knight is starting a free course on custom visuals in Power BI:

Welcome to an exciting new FREE class that I am launching today!  Over the next year (that’s right year!) I will be releasing one module a week detailing how to work with all of the Power BI visuals available in the Custom Visuals Gallery.  You might ask why am I doing this?  Well The Microsoft Power BI team and the Power BI Community, through the Custom Visuals Gallery, have expanded the data visualization capabilities of Power BI drastically but unfortunately has provided little and in some cases no direction on how to use these the new features.  These Custom Visuals are designed by Microsoft on occasion but more often then not the Power BI Community has put in a lot of hard work to provide these great new features for everyone to use.  My thought is if the Power BI Community is willing to design and publish these without asking individuals for payment then I would love to provide training on these features to you for free as well.

This sounds like a nice course.  Good on Devin for doing this.

Comments closed