Book Review: SQL Server Query Tuning and Optimization

I was pleased to be sent a pre-release copy of Benjamin Nevarez's new book SQL Server Query Tuning and Optimization. Last time, I reviewed his High Performance SQL Server book.

This book seems to be somewhat new and somewhat an update, but this time with the main focus on query tuning and optimization. That's pleasing as the main way to get better performance out of SQL Server is to fix the queries. much more so than anything to do with the hardware or server configurations that so many people focus on.

I've known Benjamin for a long time. He's a very skilled SQL Server professional. And again the technical reviewer for the book is another very skilled old friend in Mark Broadbent. Brandon Leach, Ajmer Dhariwal, and Artur Wysozanski were also technical reviewers. Once again, I had high expectations.

And once again, I wasn't disappointed.

The book covers a rich set of topics, including most things you need to know when performing query optimization for SQL Server. It provides a detailed background to each area, and then recommendations on how to proceed.

Once again, it was so pleasing to read a technical book that was well written, used English well, and  wasn't full of technical errors. Nowadays, there aren't many technical books that fall into this category. Several times lately, I've been sent technical books for review, and I've ended up telling the publisher that they don't want me to write a review as those books were so poorly written. It's important to support people who are still writing quality technical books.

Now, were there again areas that I disagreed with Benjamin on?

Yes.

I just don't share the enthusiasm for the in-memory OLTP options in SQL Server, even for temporary objects. I wish it wasn't so, but I've spent so much time trying them over the years, and let's just say, I don't use them. The SQL Server team spent so much money on their in-memory OLTP and in its current form, even in SQL Server 2022, it just doesn't deliver. I think it's one of Bob Ward (product team)'s dreams to ever have me happy with it, but that's not happened yet. It shines in a few very niche areas, but for most customers, I tell them to avoid it.

Another area that I'd also differ on now is the Data Collector. I really don't think this has much future. Benjamin covers it still in this version of the book, but I'd strongly suggest that customers give it a miss.

Were there again areas where I'd love to see the book improved?

Yes.

Here are some suggestions:

  • I'd like to see statement terminators in all the code (personal bugbear).
  • The order of the topics in theory makes sense, but again in practice, I'm not so sure. I'm concerned that most developers who pick up this book won't get through the theory, to then find the gold. Perhaps there's a need for another book that just lists all the common issues for query tuning, and then for each one, explains what's going on. Alternately, it might have made for an interesting appendix, to have a list of common issues, and for each to tell you which parts of the book are most relevant. So many developers would be just looking for quick answers, and aren't going to read the whole book to find that.
  • I'd love to see more info on working with captured traces. There is so much value in this analysis, of both the core queries, and the normalized versions of the queries. Nowadays, it's the number one thing I start looking at when doing performance tuning work on systems that I haven't worked on before.
  • I'd like to see the book call out even more on the importance of appropriate application design. In my work, I find that at least 70% of the SQL Server performance-related issues that I run into, are application design issues.

The Verdict ?

Overall though? Again, a wonderful book.   9 out of 10.

It should be released very soon: https://packt.link/AbvGr

Want to learn more?

If you'd like to learn much more about tracing queries and improving your T-SQL, check out our online courses at https://training.sqldownunder.com

 

Why is Greg holding a book about a duck?

One weekend many years ago, my youngest daughter Erin was looking for something to do. She was a very creative child so I suggested "why don't you write a book?"

She said she could write one, if she only had a title. I told her that you could write a book about almost any title. I randomly picked:

What the duck didn't see

(with the emphasis on didn't)

To get her started, I wrote some content, then asked her to continue. She did the same, and then I wrote some more. I turned out to be quite fascinating. I had no idea where she was taking the story and I'd be excited to read what she'd written. Along the way, my eldest daughter Kirsty wrote some content as well. My second daughter Andrea's name was used for the main person in the story.

When life intervened, we hadn't quite finished it, and quite a while elapsed. So last year, I thought it was time to complete it. And this (relatively short) book is the result. I also thought it would be great for the two of them to be "published authors".

It's the story of Andrea Blowhard who is a new detective in Lyttleburg, looking to make a great impression on her new boss. And a fascinating case fell right into her lap. You can find it here:

I hope you enjoy it. But more importantly, I wanted to share this as a concept that you might consider with your own children.

 

Book: Implementing Power BI in the Enterprise

It's been a while coming, but my latest book is now out. Implementing Power BI in the Enterprise is now available in both paperback and eBook. The eBook versions are available in all Amazon stores, and also through most book distributors through Ingram Spark distribution.

I've had a few people ask about DRM-free ePub and PDF versions. While the Kindle version on Amazon is their normal DRM setup, you can purchase the DRM free version directly from us here:

https://sqldownunder.thrivecart.com/implementing-power-bi-ent-ebook/

It contains both the ePub and PDF versions.

Book Details

Power BI is an amazing tool. It's so easy to get started with and to develop a proof of concept. Enterprises want more than that. They need to create analytics using professional techniques.

There are many ways that you can do this but in this book, I've described how I implement these projects.  And it's gone well for many years over many projects.

If you want a book on building better visualizations in Power BI, this is not the book for you.

Instead, this book will teach you about architecture, identity and security, building a supporting data warehouse, using DevOps and project management tools, learning to use Azure Data Factory and source control with your projects.

It also describes how I implements projects for clients with differing levels of cloud tolerance, from the cloud natives, to cloud friendlies, to cloud conservatives, and to those clients who are not cloud friendly at all.

I also had a few people ask about the table of contents. The chapters are here:

  • Power BI Cloud Implementation Models
  • Other Tools That I Often Use
  • Working with Identity
  • Do you need a Data Warehouse?
  • Implementing the Data Model Schema
  • Implementing the Analytics Schema
  • Using DevOps for Project Management and Deployment
  • Staging, Loading and Transforming Data
  • Implementing ELT and Processing
  • Implementing the Tabular Model
  • Using Advanced Tabular Model Techniques
  • Connecting Power BI and Creating Reports

I hope you enjoy it.

Book Review: The Subtle Art of Not Giving a F*ck

I get a lot of book recommendations from friends. One that I'd heard about a number of times was Mark Manson's book The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life so I thought I'd check it out.

I don't overly love the title. I think having expletives in book titles is a bad omen. For me, they are in the same category as, and are reminiscent of, childhood fart jokes. And the book is full of endless repetition of the same expletives. I can only imagine Manson thought they made for good shock value. For me, they don't.

The premise of the book is pretty straightforward. Manson argues that many aspects of life are pretty messed up and for so many of these aspects, there's nothing you can do about them.

This is not a "think positive" book. The analogy from the publishers is that instead of telling you how to turn lemons into lemonade, he's telling you that you need to learn to stomach lemons. At least then you have a chance to be happy.

Clearly, having bad things happen to you can sometimes produce good lessons, but obviously, too many bad things can't be borne.

What is an interesting discussion in this book, is about how you define happiness. I agree with him that there's little point worrying about things that you can't change. I'm a little more positive than him though, on how many things you can actually change.

Many people seem to go through life with the "if only" syndrome. If only I could get a better job, I'd be happy. If only I could pass this exam, I'd be happy. Often these same people have a very unhappy life in the meantime. A different frame of mind might help there.

The Verdict

I liked a lot of the messaging in this book, once you ignore the expletives designed to slap you in the face.  6 out of 10 for me.

 

 

Book Review: The Other Animals

I love short stories, so I was really excited when one of the Audible Originals a while back was a set of eight short stories. The Other Animals is a compilation of short stories by a variety of authors (Daniel Mallory Ortberg, Ken Liu, R. Eric Thomas, Lulu Miller, Shruti Swamy, Max McClure, Kaeli Swift, and Kelly Weinersmith).

I really didn't know what to expect with this book. The ratings from other listeners are high. Audible describe it as being "written by a crew of scientists, literary writers, and comics, and informed by animal behavioral science – explores what animal perspectives can show humans about the world we all share."

All the stories are tales told from the perspective of animals.

I have to admit that I did find some of it cute, but I really struggled to persevere with it. There's a story where a vulture contemplates his role in killing; a story where a worm breaks up with a snail; another story where a whale falls in love with a song.

Some listeners really, really liked it. For the life of me, I couldn't find it "gripping" as others did.

Even though I like a lot of "off the wall" things, I'm clearly not the target audience for this book. I just couldn't bring myself to finish it. Life is too short.

The Verdict

There are obviously people that love this book but clearly I'm not the target audience. 3 out of 10 for me.

 

 

Book Review: Living Forward by Seth Godin

I have a lot of people who recommend books to me. I order many of them. If the book has impressed one of my friends, I'm keen to see what they liked about it. That's how I came to read Living Forward: A Proven Plan to Stop Drifting and Get the Life you Want by Seth Godin.

The title is making a pretty big claim, but the content? It's ok.

There are a great number of books that suggest you need to do some basic things:

  • Decide where you are
  • Decide where you want to be
  • Fill in the gaps

So from that point, there's nothing Earth-shattering there. I did like the way though that Godin provided a pretty specific methodology for achieving the outcomes you want. It's based around being both deliberate and proactive.

The friends that liked this book, particularly mentioned that it helped them break out of a cycle of procrastination. We all can suffer from that, but some suffer more than most, and this could be the prompt they need.

Godin also, of course, keeps concepts of a balanced life in mind, but he talks about just how easy it can be to simply drift through life.

The Verdict?

I'd give this one 6 out of 10. I didn't find anything very new, but I did like the structure it provided. I know I have a number of friends who could benefit from the thinking.

 

 

Book Review: The Lean Startup by Eric Ries

A few weeks back, I finished reading The Lean Startup: How Constant Innovation Creates Radically Successful Businesses by Eric Ries.

There have been a lot of books on Lean methodology over the years, so I didn't know what to expect with this one. But it was published back in 2001 (i.e. the turn of the century) and that's when the Lean methodology was still fairly new in entrepreneur circles.

I've seen others comment that this was the "single most informative book on the iterative entrepreneural process".

Ries looks a using the approach to consider how companies are created and evolve, and how their new products are launched into the market. He focusses on how to create a startup that's a long lasting startup. So many businesses crash and burn each year, mostly within their early stages. Ries looks closely at how you can create something new, but right in amongst very uncertain times.

It's a fascinating book. I just wish it was a little more lively. It does plod along a bit, but the content is excellent.

The Verdict

An excellent book. 8 out of 10. The excellent content could have been delivered a bit more lively though.

 

 

Book Review: Starting Strength

Over the years, I've had a number of friends tell me that they really enjoyed Starting Strength by Mark Rippetoe, and illustrated by Jason Kelly. Many regard it as one of the best and most useful fitness books ever written. So I had to read it, even though some of its strongest supporters (pun intended) revered it, almost to some sort of cult status.

What an interesting book.

As I age, I realise the importance of mobility and core strength. I just wish I'd put more importance on it during my life.

If you look at the quality of life of older people, mobility is the primary thing that determines much of how they get on. The thing that often immobilises them are falls and accidents, many of which might have been avoided with greater core body strength. Rippetoe makes it clear that resistance training is the key to that.

Rippetoe's writing style is very opinionated and forceful. There are many critics of his style though. His diet advice, in particular, seems misguided, and he doesn't talk about how this type of training might go wrong. In fact, just the opposite. He points out that injuries are likely to happen.

If you do read this book, I'd strongly suggest the real book, not the Kindle version, so you can see the illustrations. They are well presented.

The Verdict?

I liked it, albeit with some reservations. 7 out of 10.

 

 

Book Review: Passive Income: How to Make Money from Home, Skyrocket your Income at Lightning Speed

I tend to read a large number of entrepreneur-related books. Some are better than others. I almost didn't get a copy of  Passive Income: How to Make Money from Home, Skyrocket your Income at Lightning Speed as the title pretty much put me off as it sounded so cheesy, but for some reason I did listen to the audiobook.

I also don't normally write reviews for books that I really don't like. I didn't like this book.

It's interesting that the top review from US Amazon is titled "Worthless nonsense" and commented that there's nothing to learn in this book. It's all been written elsewhere, and better.

But I had a feeling that this book might split the potential audiences. And right on cue, there are many reviews saying how great it is, and how it was almost life-changing for some.

If you really, really haven't got any ideas on how to earn a passive income from home (and I have people I know in this category), this book might work for you. But for anyone else, it's a solid pass. I found it endlessly overstated what seemed to be just patently obvious.

The Verdict?

For me, 1 out of 10. For someone just starting to think about how they might make an income from home, and haven't yet done any real reading, perhaps 4 out of 10.

Book Review: High Performance SQL Server

I was pleased to get sent a copy of Benjamin Nevarez's new book High Performance SQL Server. I've known Benjamin for a long time. He's a very skilled SQL Server professional, and you'll see him at conferences around the world. (Or at least once Covid is tackled more completely).

And the technical reviewer for the book is another very skilled old friend in Mark Broadbent. So my expectations were high for the new edition of this book.

I wasn't disappointed.

It was refreshing to read a book that covered so much of the core knowledge that's needed when working with SQL Server and getting it to perform well.

Benjamin covers a wide variety of topics: an introduction to how SQL Server works internally (including now on Linux), how to configure it and how to work with tempdb. He then headed into monitoring, so that you could find what issues need to be dealt with. The book then looks at performance troubleshooting, and indexing. It finishes with a discussion of the Intelligent Query Processing features added in recent versions followed by a discussion on storage.

As I read, I kept seeing how he led into topics, and as soon as I'd think "I hope he mentions topic X" as I thought it was important, he'd then describe topic X. There were a few areas where I disagreed, but they were few and far between.

I can't tell you how pleasing it was to read a technical book that was well written, used English well, and  wasn't full of technical errors. I've seen so many books lately that just aren't like this. By comparison, I was the tech reviewer on a book just the other day, that I'd rather I'm not mentioned in the book at all once it's released. It was so poorly written.

Now, were there areas that I disagreed with Benjamin on?

Yes.

In particular, I just don't share the enthusiasm for the in-memory OLTP options in SQL Server, even for temporary objects. I've spent so much time trying them, and let's just say, I don't use them. I'm pretty sure if I extended Benjamin's examples on those a bit further, I think he'd agree.

Were there areas where I'd love to see the book improved?

Yes.

Here are some suggestions:

  • I think there are a few areas that are suffering from being updates, rather than having been written from scratch recently. As an example, Benjamin linked to an MSDN white paper that I wrote in 2008, and while still somewhat relevant, I did an update to that paper in 2012. That would be a better reference.
  • The discussion on storage feels dated. What I would also love to see discussed in this section is info on other current challenges in this area. For example, the impact of de-duplicating I/O subsystems.
  • There are a number of style aspects I'd love to see changed. I'd like to see WideWorldImporters instead of AdventureWorks. I'd like to see statement terminators in all the code (personal bugbear).
  • The order of the topics in theory makes sense, but in practice, I'm not so sure. I think a lot of readers would be put off by being thrown into a discussion of TDS as soon as they start reading.
  • The discussion on filtered indexes needs to be fleshed out further. They're an awesome feature, but you have to learn to use them, not just configure them.

I'd also like to see the book call out more on the importance of appropriate application design. In my work, I find that at least 70% of the SQL Server performance-related issues that I run into, are application design issues. When you're trying to fix them at the back end, it's already way too late to get real outcomes. I realise though, that that's all many people have a chance to do.

The Verdict ?

Overall though? What a wonderful book.   9 out of 10.