2014 – My Year in Books!

There is more treasure in books than in all the pirate’s loot on Treasure Island” – Walt Disney

2014 has been quite a year for me both personally and professionally. I’ve never been much of book reader as they’ve always reminded me of my school days when reading a book was like compromising on all other good things (some of my schoolmates can resonate to that). However things gradually changed (thanks to wife), and I started to read and ended up having an year far more richer than than one I started with.

While this by any standards is a tiny number of books read during the year, I still decided go ahead and blog about whatever little I’ve read and to share my reviews.  This I believe will motivate me to read more in 2015 and could be some help for my readers.

I’m mostly reading on my Kindle (Fire HD) device which makes reading very portable, light and less expensive (given Kindle format books are much cheaper), however I still have love for physical paper ones.

Tech reads

T-SQL Programming

#1 Inside Microsoft SQL Server 2008 T-SQL Programming; Itzik Ben-Gan, Dejan Sarka; Coding & Technical; Read-Status: Completed;

Itzik Ben-Gan is unquestionably the greatest T-SQL Guru and this book is one of the best SQL references ever published on T-SQL. I’ve been working on databases since SQL 2000 and Oracle 8i days, and thought I knew ‘reasonably’ enough about T-SQL until I started reading this book.

The book is more or less is a conversation where author and readers, which at some point looks it’s not like a technical read (when it really is). Few chapters look at SQL beyond the storage engine, exploring other areas like SSDT, CLR, Hierarchical/Geospatial and Azure & xVelocity etc.

I would recommend this book any day for a SQL DBA trying to get a deeper handle on T-SQL code and beyond relational topics. This one, however, is not for beginners, so I would also recommend them to take a look at 1st book in series “T-SQL Querying“.



#2 DBA Survivor: Become a Rock Star DBA; Thomas LaRock; Coding & Technical; Read-Status: Completed;

‘DBA Survivor’ is like SQL DBA Career Guide 101. In my opinion (yes it’s just mine) this book is not really a technical reference that you may want to revisit while troubleshooting a database issue, however, its a book that you would like to refer when you feel lil lost with your career path as DBA; be it a beginner, an intermediate or an expert. Thomas LaRock is veteran DBA and also a PASS president, having a great career working in mid-to-large size organizations and whatever he talks in the book is all about his own experiences, which I’m sure you’ll be able to relate with.

Now the best part about ‘DBA Survivor’ is that if you’re a new DBA, it has a clear road map of what you should be doing to make the most of your current role and reach to the next. I repeat it is not overly technical, instead,  all it has is navigation map which will help you take do those rights things at right time and help you get there, and all of this in a simple entertaining voice.

After reading the book, I wished if could have got this book eight year back, when I started my career as a DBA, still, I’m thankful to Tom that I have read this now.



#3 Introducing Microsoft SQL Server 2014; Ross Mistry, Stacia Misner; Coding & Technical; Read-Status: Completed;

Finally after much wait ‘SQL Server 2014’ got RTMed this year, and this is first official book that covers the new SQL release. The thing to callout is that the book is ‘freely’ available in kindle format, making it a little more special (yes! you can download one right now and then resume this read).

As expected, the book pre-dominantly take quick deep dive into topics that matter most to new SQL release like AlwaysON enhancements, In-Memory Capabilities, and Columnstore indices. Being an introductory reference, none of these chapters cover the minuscule depth of the respective topics, rather provides a high-level overview of these enhancements. In addition, the author also makes an attempt to help you identify a relevant business case for choosing these new features (example what kinda workloads will get benefited from In-Memory? Or Will Bpool extension really help you gain that much desired app performance?). Don’t consider this marketing, instead its a guide to help you map your business needs to this newest SQL release.

Last, it always help to take a lead and learn something new, so then when your workplace decides to upgrade, the decision makers know whom to talk to.


Non-Tech/Business reads


#4 Delivering Happiness: A Path to Profits, Passion, and Purpose; Tony Hsieh; Business & Money; Read-Status: Completed;

‘Delivering Happiness: A Path to Profits, Passion, and Purpose’ is a great book, actually its the best I’ve read during this year. I personally recommend this book to all my family and friends. Wherever you are, whatever you do, you should be reading this book……as its talk about the most basic human trait i.e. being happy. So if you’ve been thinking this is another book from co-founder for a billion dollar start-up, havingusual insight into how successful they have been, then it’s not adequately correct. While the book still talks about how Tony Hsieh and other co-founder friends started Zappos, this one clearly goes beyond telling about how any individual or an organization can ‘really’ be successful.

Profits, Passion and Purpose are the three main elements of this book, which Tony Hsieh explains in a simple (yet uncommon) story telling way. There are too many thing that I liked about the book, in the interest of space, so I’ll list my top favorites:

  • Everyone is an entrepreneur – Tony Hsieh was into business right from age of 8 when he started selling customized buttons via mail order. It was not just about earning money instead it was about being creative and experimenting. When you read this section, do take a pause to go back in your past and ask yourself, what did you liked doing as a child and then see if you can relate some of it to what you’re doing today.
  • Profits – Profits are important, cyclical and are much easier to make when you follow a creative and less-taken path.
  • Passion – Profits alone cannot make anyone successful as they are cyclical and cannot be sustained. Passion, however is less cyclical. Combining profits with passion can make bigger impact on overall success.
  • Purpose – Even when you’ve identified your passion and path to profits (being successful) there’s still a need to have a purpose, i.e. what are those things that finally makes you a happier person.
  • Finally on Happiness? It’s beyond my explanation, as it’s so much personal to everyone. All I can say is that I’m joining Tony’s  happiness movement

The book is filled with some wisdom tweets (referred as “tweets to live by”) such as ones below:

We either make ourselves miserable, or we make ourselves strong. The amount of work is the same”; “If you have more than 3 priorities you have none



#5 The Everything Store: Jeff Bezos and the Age of Amazon; Brad Stone; Business & Money; Read-Status: Completed;

Consider this book as a memoir on Amazon and it’s undisputed leader Jeff Bezos. Author Brad Stone I believe is been able to get the most authentic details of Amazon including its founders, history, challenges, competitions, losses and triumphs.  ‘The Everything Store’ primarily focuses on Bezos (pronounced Bay-Zoes) and his awe-inspiring journey of founding Amazon. Given the author’s perspective, overall journey of Amazon seems like a Bezos personal journey and every progressing chapter will get you even with your thoughts around why Jeff is among the smartest CEO’s in relevant times. Here’s some of my favorite picks around Jeff’s leadership styles:

  1. Play Godfather – Make them an offer they can’t refuse: picking up zappos.com, diaper.com or numerous other Jeff’s negotiations
  2. Information only when necessary – Do you really know why kindle books are cheaper than their hardcover counterparts?
  3. Two Pizza Teams – Size of team shouldn’t be more that can be fed on 2 large pizza’s (this been adopted in by Google as well!)
  4. “In the old world, you devoted 30% of your time to building a great service and 70% of your time to shouting about it. In the new world, that inverts”
  5. Customer Obsession – Add that empty chair in every meeting that represent your customer and write all memo’s as journals

Further besides Amazon, the book also has an inspiring story on early formative dates of world-wide-web (WWW), talking about stuff like web mails, online retail and the eventful time of dotcom boom and bust. So if you have slightest interest in travelling back in time to understand evolution of internet and then be returned talking Cloud and e-readers (Kindle), the book won’t disappoint you.

One of my favorite quote from the book “For all great innovations it’s necessary to have the willingness to fail and be misunderstood for a long period of time – Jeff B”



#6 Steve Jobs: The Exclusive Biography; Walter Isaacson; Biographies & Memoirs; Read-Status: Completed;

When I started with the book, I was unsure if I’ll ever be able to cover it in its entirety (be able to read and understand) given the length 600 pages. And then I spent the whole of weekend reading without any major breaks and completed in 2 days! Although the book is an biography of Jobs, the details are exquisite and they cover the entire history of Apple Inc. (from Apple II to iPads).

Steve Jobs was “Diva”. He’s been the among best CEOs the world has known or will remember. Author Walter Isaacson has done a brilliant job in narrating Job’s complex personality in a compelling way. Actually planning of this book started with Jobs being alive and as such jobs has taken a great care to ensure that the books covers not just the brilliant feats but also the monumental failures that Jobs has to go thru to make Apple what it today. The book typically has 3 parts

First one covers the Jobs personal life (before Apple came to existence). Jobs was born with bundle of contradictions. Adopted since birth, he grew up with being skeptical to church and then ended up being a huge believer of Karma, followed Buddhism and got obsessed with Zen-like simplicity (know you know why iPhone’s feature just one button).

Second part, covers the birth of Apple and the challenges that lies ahead. Steve was turned out of apple, founding of NeXT, Pixar and then dramatic return to apple. This is most gripping tale of how an ordinary looking individual choose to do extraordinary things with childlike simplicity (iPhone would never have been so successful with a phone keypad). There are many other facets about the jobs personality like being highly demanding of his colleagues and coworkers, have lack of sensitivity towards others and over obsession with details / design.

Third part covers the post PC (read windows) era, that details the epic rise of Apple products like iPod, iPhone, iPads, iTunes, iCloud with Apple becoming world’s most valuable technology company.

The books is an amazing narrative not just because the subject matter is jobs, but it is also well-written (Kudos to Walter Isaacson). Also the book is not just for IT nerds or geeks, but everyone who want to dig deeper in Steve’s life, belief and obsessions that led to creation of Apple. Here’s my favorite Jobs quote

You can’t connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something – your gut, destiny, life, karma, whatever ” – Steve Jobs


#7 How Google Works; Eric Schmidt; Business & Money; Read-Status: Completed;

Google has been among the most disruptive innovators of 21st century and company has consistently been among the ‘best places to work for’. Everyone’s aware of that already, except this book explains WHY part of it?

The authors Eric Schmidt and Jonathan Rosenberg have done an impeccable job in explaining the “Why Google has been so successful?” like explaining the core philosophy that has helped Google to be the successful enterprise that it has become today or how they hire right people (aka Smart Creative) or stuff like allowing 20% of time on personal projects.

There’s been lot written about Google already like the search giant dominance over net, their mapping services, driverless cars and google glasses; however reading through the book I realized that Google primarily is data company that is managing information of 3 billion users (source Internet Live stats) and is coming up with new business models for making that data useful to us. Did you know that Google has ability to track the spread of any epidemic 200x faster than traditional ways used so far by US CDC!

Hiring is a big part of Google’s success and as such it’s given supreme importance within the company. Going thru some pages, one actually feels as if the entire company is like a huge HR dept. that is constantly looking to find and hire smart creative.

Eric and Jonathan have added tons of example like one above which explains WHY part, in an interesting story telling way. In a nutshell, the book provides a firsthand account Google’s success formula, that should be helpful of all professionals and organizations that are aspiring to successful in a ‘data-driven’ world.



#8 Hatching Twitter; Nick Bilton; Business & Money; Read-Status: In-Progress;

Even before I start telling about the book, I just want to say that I’m still in middle of my read, yet I’m compelled to include this in year’s review.

Since I picked up this book, I couldn’t put it down. The first section (where I’m right now) talks about how Nick, the farm boy taught himself to code and started blogger. The book also covers lives of other founders and how each one of them brought their own unique strengths, perspectives, resources, skills and innovation to the table to make twitter what it is today. The book so far is all about the people behind the twitter and it will be interesting to read more to understand how they were able to script a collective success in spite of their individual imperfections. So I’ll come back to complete this review…!

PLURPeace Love Unity Respect


Tagged , , , , , , , , ,

SQL-Saturday #116 – Question of the day: When does a GRANT overrides a DENY in SQL Server?



SQLSaturday #116 – Bangalore

WoW!! What a great day it was to learn and connect with SQL guru’s and like minded folks who carry same passion for SQL server as I do. It’s quite an honor to meet and listen @blakhani, @pinaldave, @banerjeeamit, @vinodk_sql, @kashyapa , Rick @Joes2Pros……You guys are truly inspirational

Fellow attendees -  For those of you on Twitter, follow #sqlpass and make sure to check out the #sqlsat116 and #sqlsaturday hashtags to stay up to date

As tweeted by @vinodk_sqlRace to First 10 blog post on #SQLSat116. If you attended the event, we want to hear from you. Drop us a nudge :) …”

Here’s the first one to start with –

Fellow attendees – During the session on Security Pitfalls, Vinod gave us this interesting question to reply/tweet later.

Question: When GRANT overrides DENY in #sql server? Was asked during a session today in #sqlsaturday #sqlsat116

Answer: An explicit GRANT on a TABLE::COLUMN takes precedence on DENY TABLE #sqlsat116 #sqlsaturday

And here’s a simple test I did to get me answer

We needs 3 users/login (one being S.A.) 


–UserOne is SA on SQL Instance

–UserTwo has got READ/WRITE privileges on TEST database

–UserThree is DBO (database_owner) for TESTDB

–Step1. Create a sample table say ‘iden_test’ with 2 cols (id,name)

USE [test]


CREATE TABLE [dbo].[iden_test](

     [id] [int] IDENTITY(1,1) NOT NULL,

     [name] [varchar](10) NULL


–Step2. Run below T-SQL to DENY READ (SELECT) to UserTwo

DENY SELECT on OBJECT::dbo.iden_test TO UserTwo


–Step 3. Try running below query and this should fail with permissions issues

SELECT id FROM dbo.iden_test


Error: Msg 229, Level 14, State 5, Line 1

The SELECT permission was denied on the object ‘iden_test’, database ‘test’, schema ‘dbo’.

–Step 4. Login to server with UserThree (SA user) and run below T-SQL to GRANT

GRANT SELECT ON OBJECT::dbo.iden_test(id) TO UserTwo


 –Step 5. Login again as UserTwo and run the SELECT (per Step 3) again

SELECT id FROM dbo.iden_test


I can get the results for the specific column now.

Conclusion – A Grant on Table (Column) overrides the DENY on same object.

Varun as iVarund

Tagged , , ,

Identify queries that consume a large amount of log space in SQL Server

One of regular issues DBA’s get are about the T-log growth. Situations, wherein one “bad”  or “poorly-designed” query can eat up entire T-log space, bring the free space to zero and then bring your application down. The cause and remedy of most these issue is discussed in this KB # 317375(I’m  big fan on Microsoft KB’s).

While the KB discussed about the causes and approaches to deal with high T-log growth situations, it also hints about how we can ‘proactively’ find the queries that are consuming your T-log space at any given moment using DMV’s. Taking cue from this, I have written a below T-SQL Code:

Identify queries consuming large T-log space:

— Description: T-SQL to find queries that consume a large amount of log space in SQL Server
— Source: KB # 317375
— Author: varun.dhawan
SELECT dtst.session_id                                                       AS
       CAST(Db_name(dtdt.database_id) AS VARCHAR(20))                        AS
       Substring(st.TEXT, ( der.statement_start_offset / 2 ) + 1,
       ( (
       CASE der.statement_end_offset
       WHEN -1 THEN Datalength(st.TEXT)
       ELSE der.statement_end_offset
                                                                      END –
       der.statement_start_offset ) / 2 ) +
       1)                                                                    AS
       Coalesce(Quotename(Db_name(st.dbid)) + N’.’ + Quotename(
                st.dbid)) +
                N’.’ + Quotename(Object_name(st.objectid, st.dbid)), ”)     AS
       dtdt.database_transaction_log_bytes_used / 1024.0 / 1024.0            AS
       ‘MB used’,
       dtdt.database_transaction_log_bytes_used_system / 1024.0 / 1024.0     AS
       ‘MB used system’,
       dtdt.database_transaction_log_bytes_reserved / 1024.0 / 1024.0        AS
       ‘MB reserved’,
       dtdt.database_transaction_log_bytes_reserved_system / 1024.0 / 1024.0 AS
       ‘MB reserved system’,
       dtdt.database_transaction_log_record_count                            AS
       ‘Rec count’
FROM   sys.dm_tran_database_transactions dtdt
       JOIN sys.dm_tran_session_transactions dtst
         ON dtdt.transaction_id = dtst.transaction_id
       JOIN sys.dm_exec_requests der
            CROSS APPLY sys.Dm_exec_sql_text(der.sql_handle) AS st
         ON dtst.session_id = der.session_id

Hope that this will help you too!

Disclaimer: Everything here, is my personal opinion and is not read or approved by my employer before it is posted. No warranties or other guarantees will be offered as to the quality of the opinions or anything else offered here.

Tagged , , , , , , , ,

What is a columnstore index?

WARNING: The blog-post is based on pre-release software so things could change. For more details on CTP, please refer SQL Server Code-Named “Denali” CTP1 Release Notes

Upcoming SQL Product, introduces a new data warehouse query acceleration feature based on a new type of index called columnstore. Before we move any further exploring this new feature, I want to take time to explain the basics behind a columnstore index and how different is it from a traditional index (rowstore).

What is columnstore? And what is a rowstore?

To understand this, lets see a simple illustration below. Here I have a table with 4 columns (First name, Email, Phone, Street Address) . Below is a representation of how the index data will be stored and their associated pros and cons.


As opposed to a rowstore, a columnstore index stores each column in a separate set of disk pages, rather than storing multiple rows per page as data traditionally has been stored. So in above example, columns (First name, Email, Phone, Street Address) are stored in different groups of pages in a columnstore index.

So what’s BAD with rowstore design?

Say if we have to run a query like ‘select first_name, phone from emp’. In a rowstore design, DBMS will transfer the ENTIRE ROW from disk to memory buffer even though the query required just 2 attributes. In case of a large read intensive queries, we do so much of un-necessary disk I/O and thus wasting precious disk bandwidth.

And what’s good with columnstore design?

1. Better performance for SELECT’s – only the attributes needed to solve a query are fetched from disk, thereby saving on disk I/O.
2. Better compression ratio – it’s easier to compress the data due to the redundancy of data within a column

Really are they so good?

Wait, “There’s no free lunch”. Due to change in the index storage design, any tuple (row) writes are very expensive on a column store index. As such, in Denali, tables with columnstore indexes can’t be updated directly using INSERT, UPDATE, DELETE, and MERGE statements, or bulk load operations. Hence to perform a DML on table, we may need to disable/drop an index temporarily and then re-create post DML activity.

Hope this provides you with some initial understanding of a ROWSTORE vs COLUMNSTORE.  This feature is expected to be available in next CTP build of Denali, so once we have the build I will be able to share a demo.

Thanks of reading!

Disclaimer: Everything here, is my personal opinion and is not read or approved by my employer before it is posted. No warranties or other guarantees will be offered as to the quality of the opinions or anything else offered here.

Tagged , , , , , , , , ,

Hello world….once again

Hello World !

This is continutation to my blog @ MSDN. With this blog post, I intend to help online community using SQL Server as a Database Platform, with occasional other stuff thrown in related to other RDBMS Platforms and their respective integration issues. Thanks to my wife who’d been pestering me to blog for a year or so.

I’ve spent the past few years working on various different RDBMS platforms including SQL Server, Oracle, MySQL. My current focus area is SQL Server and it’s integration with other Microsoft Technologies like MOSS, SCOM, MOM etc.

Thanks for your time reading and I hope all my effort will help (or at least entertain) you at many levels. I would really appreciate if you could let me know what you think about it, good or bad. I always appreciate feedback :)

Sincere Thanks!



Get every new post delivered to your Inbox.