Sunday, March 8, 2015

My FAVE Smoothie

I may have mentioned that I have been able to lose about 30 pounds and keep it off for a couple years now. There was no super diet that I subscribed to other than really working on burning more calories than I consume.  In order to make sure I can make it through the day doing that without going completely crazy from hunger, I have to make sure I get enough protein and fat.  I am a big carb girl (can someone say crusty white bread, pasta, rice... yummo!), so this was difficult.

Here's a smoothie that gets me through a lot of mornings without cravings that I'd have with sugary, carb-filled "other stuff" that I used to have.

SUPER SMOOTH SMOOTHIE

1/4 medium avocado
1/2 cup plain lowfat greek yogurt
5-6 frozen strawberries
1/2-3/4 cup skim milk (sometimes I use soy milk as well)
1 scoop protein powder

As reported by myfitnesspal with the ingredients as I added them (myfitnesspal.com - LOVE it): 
306 calories, 11 grams fat, 35 g protein
Other additions for an energy punch... spinach (you will never know it's in there, but adds a healthy boost), raspberries, blueberries.  

Blend all until smooth.  This made enough for one glass... about this size... as you can see, I could not wait to drink it! :o)
ENJOY!

Thursday, March 5, 2015

Heap / Clustered / Non-Clustered Index

I had certainly hoped to post on a more frequent basis... blogging goal #1 for me: frequency of at least 2x per month... doable I think.  Call me on it!  :)

In my first ever blog post, I mentioned that I would love to teach a class in sql server. Well, to be honest, I have already been tasked with helping the other members of my team at work with performance tuning (based in part on the fab class that I was able to attend IEPTO1... sqlskills.com... check it out). So in a way I have started - although my goal is to branch out of my own company in terms of teaching, this is a great place to get my feet wet. I thought I would start my SQL blog series based, in part, on the training sessions that I've been working through with my team.

I am part of a team of developers - we support a couple analytical data stores, I've been tasked with learning as much as I can about performance tuning in a data warehouse environment. (So much more to learn!). One challenge is that much of what we read and see out there specifically related to performance tuning is directed at transactional systems - small quick batches of inserts updates or deletes. However, our issues were more surrounding loading huge quantities of data from one place to another. Then placing indexes such that we do not bring down the load process, yet make the read process quick and easy and painless. Does that sound familiar to anyone? Please please, share your thoughts here with me!! Your best tips and tricks! In the meantime, I will do my best to share what I am learning for anyone interested. 

I started my team training sessions with basic understanding of index concepts. It seemed that everyone on the team was able to take something away from this discussion, so I thought I'd share!

Heap:

The definition of a heap is a table without a clustered index.  So what does that mean?
I imagined it to be like my "to do" pile in my office at home (ok, at work too ;).  Items often get put on the pile (the heap) in the order in which they are received.  It's pretty easy to toss another item on the pile - not much work involved there. Unfortunately, I do need to go and find things in my heap every now and then and it does take a while, because I usually have to scan the whole thing in order to find the one I need.

Similar to a heap in SQL Server - it's pretty easy to toss an item (or 10 or 10,000 items) onto the heap, but (assuming no other filing system or index) a bit harder to find when I need to go back and retrieve something.  There are other "gotchas" in a sql server heap as well that make reads take longer. I will get into those in a future post...(I need to gather lots of ideas;feel free to post a comment/suggestion to help me out with my ideas list!)

Clustered Index:

OK - I will admit that as I was learning the terminology around indexing in SQL Server, I struggled with clustered vs. non-clustered.  To me - "cluster" infers a group of the same thing (take peanut clusters for example... little groups of peanuts surrounded by delicious chocolate), so a clustered index should infer something like that - groupings of my data based on the column(s) I define.  Well, not exactly.  So if you are like me - put that idea out of your head and carry on.  If you are not like me, good, carry on.

Physical order to data
When you define a clustered index you are defining a specific physical order to your data based on your key columns.  I like to think of a clustering key as the page numbers (and maybe chapter numbers) in a book.  It allows you to quickly get to the page you were looking for.  Imagine trying to find a specific chapter or page if it all was just mixed together and looked just like the rest of the words (data) in the book.  You'd have to SCAN the whole book to find what you wanted - every time.   If your key columns would not be unique, then SQL Server will "uniquify" your clustering key (this adds an additional 4 bytes per row to your clustering key and so in general, it's good to make your clustering keys unique where possible). This "uniquifier" allows SQL server to lookup that specific record when needed.  

So, the clustering key is the page number (or chapter, or chapter/page combination) and this is the data that will make its way up the upper B-tree structure in your index - the wider the key, the bigger the tree.  The bigger the tree the longer it takes to find that leaf you are looking for.  The "leaf" level of a clustered index IS your data in order of clustering key columns - all of the data is there, not just the key columns.

 

Non-Clustered Index - Just a pile of peanuts?:

OK - sorry - I should not have made refrence to my terminology reference from above! 
Certainly you have a book at home (or work) that includes a table of contents, or an index in the back of the book. This is the best thing to compare to a non-clustered index. 

  1. It includes "key" references: chapter, key word (i.e. types of animals, types of food)
    1. Non-clustered index key column(s).
  2. In the table of contents or index, it is in order by key references (chapter 1, 2, 3; aardvark, aligator...zebra, etc.)
    1. So is a non-clustered index in order by the key columns.
    2. This can be a different order than the clustered index (but note that the non-clustered index does not include ALL data from your table).
  3. It includes a reference back to the page number so that it can easily look up what might be there.
    1. A non-clustered index will always include a reference back to the clustering key
  4. It takes up space in the book.
    1. Yes, non-clustered indexes take up space!
Yes, a non-clustered index CAN be placed on a heap, and that table will still be a heap.

OK - SUMMARY:

Heap: good for inserting data, querying can take longer
Clustered index: physical order to data based on clustered index key
Non-clustered index: quick reference to help SQL Server find data in the heap or clustered index

This was relatively basic stuff.  Overall, I try to keep explanaions less than super-technical in order that people can visualize and hopefully understand without the technical getting in the way.

I welcome your feedback!!!
'til next time!
Sarah :)

Tuesday, February 3, 2015

I'm just gettin' started

Me
Since this is my first blog post, I thought I should tell you a bit about myself.

I am Sarah Falkavage - born and raised in central Wisconsin - yes I love cheese.  First and foremost I am a mom of three amazing (read "crazy") boys, and wife to one wonderful (read "crazy") husband.  We have a dog, three fish a lizard and a turtle named Jeff.  I have recently made a big move back to my hometown - and while it was probably the most difficult endeavor I have ever had to go through - I am finally confident (and I was not always) that we are where we should be.

My day job is at an insurance company as a data analyst - really love it.  I have my hands in SQL server more than I ever thought I would.  It might sound corny, but this is probably about as close to a dream job as I could get.  I think I was about 30 when I figured out what I wanted to be when I grew up.  I wanted to work with databases - not just MS Access (although it was fun seeing what I could do with that), but, you know, a real database - like Oracle or SQL Server. I got my opportunity about 7 years ago and have not looked back.  Over that time I have had the opportunity to learn an educational institution software system called Jenzabar, the back-end database for an ERP system called IFS (a system which I had learned from a business perspective about 10 years earlier) - and now on to some really exciting stuff - analytical reporting for an insurance company. 

I can hear the ohh's and ahh's... no really... it is exciting!


In my spare time I enjoy a good run (I run about as slow as one could run and still call it running, but I do it), downtime with a crochet project (yep, yarn crafts), and sharing my best ideas for the yummiest "health" food I have found.  I have managed to lose 30 lbs by changing my lifestyle - and despite a career in IT - about as much at a desk as one can get - I've kept it off for over a year, and I feel great!



My Inspiration
You might ask, then, why I am blogging about SQL Server.  Good question. Recently I read a post on Paul Randall's SQL Skills blog indicating that he was offering up the opportunity to be mentored by him. Wow... talk about an inspiration.  If you have not already seen the wealth of information they offer up on sqlskills.com - I highly recommend it.


I had the great opportunity to attend a SQL Skills course a few months back and I am still studying and testing, and trying to replicate little proofs that Paul and Kim had demonstrated - tweaked a bit for our environment. It was a great course, and I thought to myself that teaching a course in SQL Server would really be something I would enjoy.  I have found over the years that I really enjoy teaching.  [Now, my husband was a high school teacher, and I am definitely not crazy enough to follow in that path.  Kudos to all the teachers out there - you have my utmost respect!] I do, though, like to teach in a pseudo-classroom environment (meeting rooms - online or in person).  I love it when the people in my "class" ask questions because their curiosity has been piqued or I have hit on a topic of particular interest.  So - what's the first thing I would do with a mentorship from/with Paul Randall?  I would try to glean all I could from his technical, business and most specifically teaching experience.  A goal of mine would be to speak at a SQL Server conference - probably locally at first, but ultimately at a regional or national level.  That possibility really excites me - and I think that Paul would be able to help get me there.



My Blog
Already I have been inspired to write this post, but I am definitely looking forward to posting more.
So as  I consider blog posts, they will likely be about one of three things. 1. sql server and some cool stuff I've learned about it, 2. the amazingly crazy world of raising 3 boys, or 3. while I'm no health nut, sharing the best "healthy" food I have found.
 

Feedback
I aim to teach, inspire and if I'm lucky, entertain.  I hope that as more posts are added that you will leave me some feedback, additional hints, and musings of your own.


I'm looking forward to this!
'Til next time!