Showing posts with label SQL Rally. Show all posts
Showing posts with label SQL Rally. Show all posts

Thursday, May 10, 2012

SQL Rally Deck's and Demo's Up

Hello Dear Reader!  I'm coming to you live from the wonderful SQL Rally in Dallas Texas.  I have two sessions today, and the Slide Deck's and Demo's are live on the Resource Page.  Feel free to download them and see if you'd like to come join me, or download them and follow along!

"So Balls," you say "What are you presenting on?"

Glad you asked Dear Reader, and away we go!



TRANSPARENT DATA ENCRYPTION INSIDE AND OUT IN SQL 2012




The great thing about this session is even though we are using SQL 2012 99.999% of this is the same as SQL 2008 & 2008 R2.  So come and learn about TDE and leave with scripts that will help you deploy this if you are interested. I hope you'll stop by at 10:15 am I'm in room 302/303

Here's the Abstract:

Security is a very important part of your job and in how data is utilized. We have many tools to make data more secure, and starting in SQL Server 2008, we were able to add Transparent Data Encryption to that list. Find out what it does and doesn't do, how it effects read-only filegroups, performance, and compression (backup and row/page), what the X.509 encryption standard is and why you should be careful of what you store and where, and other advanced features and management tips.


SQL INTERNALS, RECOVERY MODELS, AND BACKUPS! OH MY!

This is a fun session that is all about learning.  We have demo's and we have fun, but a lot of getting better and advancing your career in SQL Server is knowing the concepts. We won't be Deep Diving but we will touch on ACID, B-Tree's, Transaction Isolation Levels, Transaction Log Internals, Recovery Models, and Backups.  I hope you'll come join me at 4:00 in room 302/303.


Here's the Abstract


The more you know about SQL Server, the more you understand how it works. SQL Server is a product we use every day, and most of us know the big concepts. At the 10,000-foot view, we know what databases, tables, and columns are. But what makes up those databases, tables, and columns? What are records, pages, extents, and allocation units? What are Full, Simple, and Bulk-Logged recovery models? What are the differences between Full, Transaction Log, Differential, and Filegroup backups? What is a piecemeal restore? This is an introduction to these concepts using SQL Server 2012. In this session, you will learn about the internal structure, recovery models, and backups and be better prepared for future learning and managing SQL Server.


WRAP IT UP


I hope you enjoy your day out here there is A LOT of SQL Learning to be had!


Thanks,


Brad

Wednesday, May 9, 2012

Thank You to the People That Get Us There



http://www.flickr.com/photos/saygoodie/4548042971/

Hello Dear Reader starting today out in Dallas Texas at the Dallas Convention Center is the Second Annual SQL Rally.  This year Sri Sridharan (@SQLRocks | Blog) and a cast of many other volunteers, click hear to read about these great volunteers, have been hard at work to put together this great event.  There are SQL MVP’s, MCM’s, the Microsoft CSS Team, and even your friendly neighborhood SQL DBA’s such as myself.

While we take a couple days to cram in as much SQL Learning and SQL Networking as we can I wanted to take a minute to say Thank You.  Chances are you have someone that you will be Thanking as well.  If we take a minute to ask the volunteers, the comities, and different SQL Community Leaders they would have someone to Thank as well.  So as we start our SQL Rally let’s start it off on the right foot by saying Thanks to the people that allow us to participate in events like these.

“So Balls,” you say, “who are you saying Thank You to?”

The most important person in the world Dear Reader, the person that gets me there so I can participate in events like these.

THE PEOPLE THAT GET YOU THERE
http://www.flickr.com/photos/shutterbri/5168715471/

When you travel you leave your home behind.  I know not an earth shattering conclusion, but when you leave your home who is there taking care of it? 

When the kids were little they didn’t want to go to sleep at night because they didn’t want to miss anything.  They wanted to stay up and play, or stay up and watch TV.  I used to tell them that while they slept the whole world stopped, and it wouldn’t start again until they woke. I wanted them to be at ease about falling asleep.  They worried what they were missing, and I didn’t want them to worry.

As adults we know that is not true.  When we sleep we know another part of the world is up and active.  In the IT world we count on this.  We expect the system that we put in place to be used while we are not looking.  The whole profit model of the internet and “Buy Now” buttons work on that philosophy, things keep running 24 hours a day.

Life is like that too.  When you are not home, who keeps the show running?  Do you have someone that you can depend on?  Someone that says to you, “Don’t worry go, I can handle this”, someone that you have absolute faith in.   Do you have someone that keeps you from worrying?


THANK YOU TO MY WIFE
http://www.flickr.com/photos/21644167@N04/4335299130/

1st and foremost I need to say a big Thank You to my wife.  We have 4 kids.  She has given me a beautiful family, worked like crazy to support my career and my crazy hours, and she does an amazing job making our house a home.  Did I mention we have 4 kids?

I’ve recently taken a new job and I’ve been traveling quite a bit.  When you do not travel for work, then events like SQL Saturday’s, SQL Rally, SQL Connections, and the PASS Summit seem like just a couple of events a year.  Just a couple times to go away.  You say things like, “This will make me better at what I do, and besides it’s not like it is forever, it’s just a week or a weekend”.  But those things start to add up.  And when you pile on traveling for work as well, it stacks up even higher.

So when I’m gone I’m not able to help if a kiddo wakes up at 2 am tossing his or her cookies all over the bed.  If there is a noise in the middle of the night, I’m not there to go looking, and it means one parent is stretched thin.  While I’m speaking I can’t kiss a scraped knee or check out a flat bicycle tire. 

There are a million little thing and big things that my wife does during the day, she has a full schedule between family, work, and school.  When you take one parent out of the picture, then that day takes on a whole new level of busy.  Make sure the boys have lunch money, let the dog out, make sure the baby’s lunch is made, let the dog back in, get the baby off to day care, let the dog out,  pay the bills, clean the house, let the dog back in, do laundry, and don’t forget to let the dog out.  And that doesn’t even include things she needs to do for herself.  

The fact that she can make it look so effortless, is a testament to just how awesome she is.  So before I head off, I need to say Thank You.  I’m very grateful, and I want to say that without you to support me I wouldn’t get to go participate in these great events that I write about, it just wouldn’t be possible.  You’ve taken such good care of me that I cannot Thank You enough.  Thank You, Thank You, Thank You.

DON’T FORGET TO SAY THANK YOU

http://www.flickr.com/photos/avardwoolaver/7137096221/
Hopefully I’ll see you when I’m are out in Dallas, but before you get there stop and think about who it is that is making your trip possible.

Chances are I’m not alone in this.  You probably have someone in your life that makes it possible for you to do the things that you do.  Someone that while you’re away, notices more than anyone else. Someone who is happy for you when you get opportunities, helps cover for you when you need it, and offers you the support you need to get the job done.  Someone that when you get excited you want to run to and share the news about <insert good news of your choice/>. 

Someone that while you’re away, notices more than anyone else.  Make sure to say Thank You.

Thanks and I'll see you out there,

Brad

Monday, February 27, 2012

I’m Going to SQL RALLY!




Hello Dear Reader, I’ve just received great news I’M HEADED TO SQL RALLY 2012! But I didn’t get here on my own, I have you to Thank.  And I would like to do just that.  Thank You to everyone who voted for me as part of the recent Community vote!  I really appreciate it.  It is always an honor to be picked to participate in a SQL event, but it means a lot when your peers vote you in.

I promise that you will not be let down, I’ve got not one, but TWO amazing sessions that made it through the voting.

“So Balls,” you say, “What are you presenting on?”

Great question Dear Reader, and away we go!


Transparent Data Encryption Inside and Out in SQL 2012

Security is a very important part of your job and in how data is utilized.  We have many tools to make data more secure, and starting in SQL 2008 we were able to add Transparent Data Encryption to that list.  Find out What it does and What it doesn’t do, How it effects Read-Only Filegroups, Performance, Compression (Backup and Row/Page), What the X.509 Encryption Standard is and Why you should be careful of what you store and where, and other Advance Features as well as some tips on how to manage it.


I’ve had a lot of fun presenting on this topic in the past.  Transparent Data Encryption is a wonderful technology that we were able to start using in SQL 2008.  I was lucky very early on that as soon as I started working with 2008 I was working with TDE. 

When you use TDE there are some very important things to know and consider the first is what TDE does and doesn’t do, the second what physical changes actually occur within your database, and finally how you manage certificates and how they affect your recovery scenarios for your databases.

I’ve done a Lightening round version of this presentation for OPASS, the Orlando SQL Server User Group, my friends at Publix, and for SQL Saturday 79 South Florida this past year.  This year I start off the year with a Bang presenting on this topic at SQL Connections in Las Vegas, and now I’ll get to present on this at SQL Rally 2012 as well!


SQL Internals, Recovery Models, and Backups! OH MY!

The more you know about SQL Server the more you understand how it works.  SQL Server is a product we use every day, and most of us know the big concepts.  At the 10,000 foot view we know what  Databases, Tables, and Columns are.   But what makes up those Databases, Tables, and Columns.  What are Records, Pages, Extents, and Allocation Units?  What are Full, Simple, and Bulk-Logged Recovery?  What are the differences between  Full, Transaction Log, Differential, or Filegroup backups?  What is a Piecemeal Restore?  This is an introduction to these concepts using SQL 2012.  In this session you will learn about the internal Structure, Recovery Models, and Backups and be better prepared to for Future Learning and Managing SQL!


When I first put together this presentation it was meant to be a leap frog session. 

“So Balls,” you say “I’m not playing leap frog with you.”

No worries Dear Reader, I’m not playing a game, but what I mean by leap frog is I want you to leap ahead.  As I’ve studied SQL Server I’ve noticed that there are some fundamental concepts that you encounter over and over again.

The reason because they are all interrelated.  A.C.I.D., Transaction Isolation Levels, the internal components of SQL Server’s Relation & Storage Engine, B-Tree Structures, Pages, Allocation Units, Transaction Log management, Recovery Model’s, and Backups (that’s a mouth full OH MY!).  I’m not going to make you an expert, but I’m going to arm you with knowledge and concepts to allow you to go forth and be better prepared for future learning. 

But what we cover will apply directly to how you would choose the type of backups that are appropriate for the database systems that you manage.

THANK YOU

Once again Dear Reader and Dear SQL Community, I would just like to say Thank You.  I hope to see you and I hope to see you at SQL Rally 2012!

Thanks,

Brad

Monday, February 6, 2012

SQL Rally 2012 Vote For Me!


Hello Dear Reader!  Last year I tossed my hat in the ring on the world of Presenting.  This was a tremendous experience for me.  Presenting is a whole other skill set, one that I had not exercised very often.  The more I presented the more I learned.  I received wonderful questions and feedback that helped me grow from SQL Rally 2011, presenting Page & Row Compression How, When, and Why to the PASS Summit 2011 where I presented Page & Row Compression: Deep Dive.  All of this and there is still more to go into. 

"So Balls," you say, "What are we voting for again?"

Great Question Dear Reader!  While I've presented loads on Page & Row Compression, in 2012 we are adding Spatial Compression to the mix and Vertipaq Compression that gives us Columnstore Indexes.  Not to mention we still have Backup Compression as well.  Put all that together and I've got enough information to fill a whole day, and that is just what I'd like to do!

I've submitted a Full Day Pre-Con on Compression to SQL Rally 2012.  I am honored to say that I'm up for vote along with some other really great sessions.  And you Dear Reader get to vote and decide on who the final two are that make it.


THERE'S ALWAYS ROOM FOR COMPRESSION

The title of my Pre-Con is "There's Always Room for Compression" and here is a copy of my abstract.


Come on There’s Always Room for Compression!  In SQL 2012 Compression hits with a Bang.  We should all be taking backups, and Compressing our backups as well.  But what advanced feature can cost Compression performance and how can you re-claim it?  SQL 2008 we got Backup and Page & Row Compression, SQL 2008 R2 gave us Unicode Compression to add to the mix, and SQL 2012 give’s us Page & Row Compression for Spatial Data.  On top of that we get VertiPaq Compression for Columnstore Indexes.   If you are running an OLTP shop, working heavily with BI, or a mix of the two Compression in SQL Server 2012 is something you should learn about.  There are 3 bottleneck’s in any Database, find out how Page & Row Compression can help you offload I/Op’s for CPU.  BI heavy shop? Understand What Columnstore Indexes are, how they work, and how you can use them. 

If you are interested in Compression, looking at using this at work, or trying to figure out best practices for Compressing Data vote for me!  We will Deep Dive Page & Row Compression and look at the internal components, how it works, how you monitor it, and that will lead to a greater understanding in how to apply it.  The internals of Columnstore indexes using Vertipaq Compression, we will be spelunking on those internals as well!  Come on spelunking on internals, that just sounds fun!  *I first heard that phrase from Paul Randal(@PaulRandal | Blog), it is his but I'm borrowing it J!


Not only will we be Deep Diving a couple different area's but I want this to be an interactive day.  I will be putting together a Sample Database that we will use so we can work together and by the end of the day you will have hands on experience with Determining what Tables are good candidates from Compression, Compressing them, taking baselines Before and After in order to see what benefits that we have achieved.


Compression can help you if you an OLTP shop or if you are a DBA who works primarily with BI.  There is something for everyone.


GO VOTE!

Even if you do not vote for me there are a lot of really great Pre-Con's that you can vote for, (Like my friend & Co-Worker Bradley Schacht(@BradleySchacht | Blog) "The 3 P's of Presentation (PerformancePoint, PowerPivot, Power View)".  All you need is an active login for PASS and you can vote.  Please Go cast yours today Click Here!

Thanks,

Brad 

Thursday, June 16, 2011

SQL Rally Q & A Row Compression with Variable Legnth Unicode


This is another follow up on the Q & A’s that came about from SQL Rally, this question was asked by Jim Murphy (@SQLMurph | Blog).   This wasn’t so much of a question as it was a discussion during the presentation. 






I have Slide, see below, that lists the data types that can use Row Compression.  



Row Compression specifically takes all the empty space out of Fixed Length Data Types and stores them as efficiently as possible.  So in essence we take a fixed length field and treat it as if it has a variable size.

Jim very astutely pointed out that I had nvarchar listed as a Data Type that compresses even though it was not a Fixed Length Data Type and Jim wanted to know how Compression worked on an nvarchar Data Type.  To be perfectly honest I botched the answer.  But it led to a wonderful learning opportunity for me.

WHAT IN THE UNIVERSE IS UNI-CODE





The short answer is it is a Universal Character Set that allows for many non-English Characters and is governed by the International Standards ISO/IEC committee.  The Data Types in SQL Server that use Uni-Code are NCHAR & NVARCHAR and they use the UCS-2 character set.  UCS-2 allows exactly two bytes to represent each character.


So what in the wide wide world of sports does this have to do with Compression.  This means that when I declare an NCHAR with a 250 length that it is actually a 500 byte value.  When I type ‘Bradley Ball’ into an NVARCHAR data type instead of taking up 11 bytes of space it takes up 22.  So this encoding can utilize a lot of space that it will need when moving the data to the user, but not necessarily in Storage.


SQL 2008 R2 introduced Unicode Compression to SQL Server.  So to get back to the original question:

“Row Compression works by taking fixed length strings and Compressing out the unused white space from the record, NVARCH is a variable length string how does Row Compression work with a Variable Length Data Type?”


The short answer it strips out the unused extra encoding if there is any to strip out.  The long answer, TO THE DEMO MOBILE!

DUHNA DUHNA DUHNA DUHNA DEMO

Coolness is not Compressed for Batman

So Let’s start off by making our database.

USE master;
GO
IF EXISTS(SELECT name FROM sys.databases WHERE Name=N'demoCOMPRESSIONInternals')
     BEGIN
          DROP Database demoCOMPRESSIONInternals
     END
    
CREATE DATABASE demoCOMPRESSIONInternals
GO

USE demoCOMPRESSIONInternals
GO

Then we’ll create our table and populate it with a couple rows.

IF EXISTS(SELECT NAME FROM sys.tables WHERE name=N'myTable1')
BEGIN
     DROP TABLE dbo.myTable1
END

CREATE TABLE myTable1(
     myID INT IDENTITY(1,1)
     ,productName NCHAR(500) DEFAULT 'some product'
     ,productDescription NVARCHAR(1000) DEFAULT 'Product Description'
     ,PRIMARY KEY CLUSTERED(myID)     
) ; 

DECLARE @i INT
SET @i=0

WHILE (@i<5)
     BEGIN
          INSERT INTO dbo.myTable1(productName, productDescription)
          VALUES(
                   ('some product' + CAST((@i +1) AS VARCHAR(5)))
                   ,('Here is a Generic Product Description' + CAST((@i+2) AS VARCHAR(5)))
                   )
             

          SET @i = @i +1

     END

We’ll set on Trace flag 3604, and we’ll do a DBCC IND to get our page number, *Page Numbers will vary when you do this on your own.


DBCC IND(demoCOMPRESSIONInternals, 'mytable1', 1)
go

DBCC TRACEON(3604)
Go

And here are our pages.


Now a DBCC Page on page 153.

DBCC PAGE('demoCOMPRESSIONInternals', 1, 153, 3)
GO

Now let’s grab an edited look at our records, we mainly want to see the Length to each record in its pre-compressed state.

Slot 0 Column 1 Offset 0x4 Length 4 Length (physical) 4

myID = 1                            

Slot 0 Column 2 Offset 0x8 Length 1000 Length (physical) 1000

productName = some product1                                                                                     
                                                                                                                 
                                                                                                                
                                                                                                                 
                                                                         

Slot 0 Column 3 Offset 0x3f7 Length 76 Length (physical) 76

productDescription = Here is a Generic Product Description2               

Slot 0 Offset 0x0 Length 0 Length (physical) 0

So we can see that even though Slot 0 Column 3 only contains 38 characters it’s length is 76.  You can see the doubling of the fixed length field as well looking at Slot 0 Column 2, even though it is an NCHAR(500) it has a length of 1000 bytes.  Now let’s apply Row Compression.


ALTER TABLE dbo.myTable1
REBUILD WITH (DATA_COMPRESSION=ROW)
go


We need to do another DBCC IND to get our newly rebuilt pages.

DBCC IND(demoCOMPRESSIONInternals, 'mytable1', 1)
go

Here are the new pages.



Now let’s do a DBCC Page on page 155 and let’s take a look at our data page and get the lengths.

Slot 0 Column 1 Offset 0x4 Length 4 Length (physical) 1

myID = 1                             

Slot 0 Column 2 Offset 0xc Length 1000 Length (physical) 13

productName = some product1                                                                                     
                                                                                                                
                                                                                                                
                                                                                                                 
                                                                         

Slot 0 Column 3 Offset 0x19 Length 76 Length (physical) 39

productDescription = Here is a Generic Product Description2              

Slot 0 Offset 0x0 Length 0 Length (physical) 0

We see that the length is reduced greatly.   Slot 0 column 1 going from 4 bytes down to 1.  We see that Slot 2 went from 1000 Characters down to 13.

But the answer to the question lies in column 3 which went from 76 bytes down to 39.  When your nvarchar strings get to be even longer that get’s to be more space savings.  We did a nvarchar 1000.  If we maxed out that value it would be 2000 characters.

So let’s do that, we’ll update our values to max out our strings.

DECLARE @i INT
SET @i=0

WHILE (@i<5)
BEGIN
     UPDATE dbo.myTable1
     SET productname = (REPLICATE('a', 499) + CAST(@i AS VARCHAR(1)))
     WHERE myID=@i

     UPDATE dbo.myTable1
     SET productDescription = (REPLICATE('b', 999) + CAST(@i AS VARCHAR(1)))
     WHERE myID=@i

     SET @i=@i+1
END

And now we’ll take a look at page 155 again.
DBCC PAGE('demoCOMPRESSIONInternals', 1, 155, 3)
go
And what are the lengths of our slots?
Slot 0 Column 1 Offset 0x4 Length 4 Length (physical) 1

myID = 1                            

Slot 0 Column 2 Offset 0xc Length 1000 Length (physical) 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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbb1                                

Slot 0 Offset 0x0 Length 0 Length (physical) 0

WOW, so even when we max out our fields, Row Compression still provides us with savings.  Slot 0 Column 2 is 1000 bytes in length, but it’s physical storage is only 501 bytes, and Slot 0 Column 3 our variable length field is physically 2000 bytes but is stored in 1001 bytes.

I’m sure Dear Reader you have noticed that instead of an even 1000 it is 1001, and I would love to tell you that I know why, but I don’t.  I suspect that the 1 byte is some sort of internal byte that contains the information needed for a Unicode Character to be translated by the access methods after compression.  But your guess would be as good as mine.

Thanks,

Brad