SQL Centre of Excellence

Just announced is that Matt Massonis to deliver a WHOLE Day seminar as part of the SQL Saturday event I am helping organise with the Dublin SQL Users group. Matt is a developer on the Microsoft SSIS Product Team in Redmond, and is coming all the way from Canada!

This will be cover a number of modules aimed to help anyone heavily involved with SSIS with performance and improving their design patterns.

Course Modules

  • Module 1 - Data Flow Internals
  • Module 2 - Benchmarking and Performance Best Practices
  • Module 3 - Common Design Patterns
  • Module 4 - Lookup Design Patterns
  • Module 5 - Parallelization Design Patterns
  • Module 6 - Advanced Design Patterns
  • Module 7 - SSIS in SQL Server 2012

Its a community event, so the 199 euro cost is just to help fund the large and FREE SQL Saturday event which is nearly up to 400 registrations! Places will be limited to about 80 and I would expect these to all go, so book early.

The link to the SSIS preconference with Matt Masson on Friday 23rd March, 2012 is http://www.prodata.ie/Events/2012/SSIS-Precon.aspx

The link to the SQL Saturday event on Saturday 24th March, 2012 is http://www.sqlsaturday.com/105/eventhome.aspx

My Sessions selected at SqlBits

by Bob Duffy 8. January 2012 07:50

I’m super excited that two of my sessions have been selected for SqlBits (http://sqlbits.com/) on the 29th –31st March, 2012. SqlBits is all lined up to be the largest SQL event in Europe this year!

If you go to only one SQL event this year, this is the one. Now if you go to two events you must of course come to our very own first ever Sql Saturday which is also the Irish Technical launch for SQL 2012. its on the 23rd march and is free http://www.sqlsaturday.com/105/eventhome.aspx

here are my two sessions.

Load Testing Analysis Services (Friday 30th March)

http://sqlbits.com/Sessions/Event10/Load_Testing_Analysis_Services

Ever deployed an Analysis Services cube that worked perfectly well with one user on the development server, only to find that it doesn’t meet the required volumes of user concurrency?

This session focuses on tools and methodology to load test Analysis Services in highly concurrent environments. Including how to locate resource bottlenecks and the appropriate configuration settings that can help improve performance.

Sample source code will be supplied to help you load test analysis services. We will be focused on the MOLAP engine, but techniques are equally applicable to the new tabular data model available in BISM.

SQL 2012 Always On-Deep Dive (Sat 31st March)

http://sqlbits.com/Sessions/Event10/SQL_2012_Alwasy_On-Deep_Dive

Always On offers a huge leap forward in terms of high availability. This sessions is a demo based introduction to the high availability changes in Denali emphasising key features and benefits.

During the demonstration we will show how to seamlessly upgrade a database from SQL 2005+ to Denali with ZERO down time and then use the Always on features to simplify reporting, availability and disaster recovery.

This session will be useful for anyone who is working in a high availability environment or currently using replication to provide reporting and looking for a neater solution.

This session scored really highly in the last SQL Bits so I hope to improve the scores this time.

http://blogs.prodata.ie/post/Speaker-feedback-from-SqlBits-9-Scores-on-Doors.aspx

Voting is up at SqlBits site now. If you are going on here some sessions I hope will be interesting.

http://sqlbits.com/Sessions/Event10/Dot_Net_Data_Access_Fundamentals

http://sqlbits.com/Sessions/Event10/SQL_2012_Alwasy_On-Deep_Dive

http://sqlbits.com/Sessions/Event10/The_Accidental_BI_Adminstrator_Part_I-Cubes

http://sqlbits.com/Sessions/Event10/Load_Testing_Analysis_Services

http://sqlbits.com/Sessions/Event10/Load_Testing_and_Scalability_for_SQL_Dot_Net_Applications

 

So apart from my own sessions, what other sessions are my hot picks.

http://sqlbits.com/Sessions/Event10/Time_Intelligence_in_DAX – Alberto always delivers an excellent insight into MDX or DAX

http://sqlbits.com/Sessions/Event10/Understanding_Your_NET_4_0_Data_Access_Options – I’ve fallen behind with Silverlight and newer versions of EF so would love to catch up.

http://sqlbits.com/Sessions/Event10/Query_Tuning_Mastery_Workspace_Memory_Internals – Adams level 500 sessions. Never been to one but his reputation is excellent as an ex instructor on the old SQL Ranger programme (now MCA).

http://sqlbits.com/Sessions/Event10/Setting_Up_and_Managing_a_Secure_and_Compliant_SQL_Server – I love Bob and security/compliance is one of my favourite subjects. Would like to see Bob’s take on it – and maybe get some free IP in the process Winking smile

http://sqlbits.com/Sessions/Event10/Whats_Buried_in_the_Plan_Cache I’m going to ask some awkward questions from the back (only joking). Christina session will be well worth the visit.

http://sqlbits.com/Sessions/Event10/To_the_Cloud_with_SQL_Server_Data_Tools I Love Gert Drapers dry humour and who better to demo SSDT.

http://sqlbits.com/Sessions/Event10/How_Are_My_Servers_Today I love using SSRS to report on SQL Server health so keen to see another perspective from GrumpyOldDBA

http://sqlbits.com/Sessions/Event10/The_top_10_biggest_SQL_Server_configuration_mistakes by Christian Bolton (Fellow MCA). I hope that I already know most of these, but really want to see Christian’s perspective and I’m sure some good horror storied there.

Of course anything by the SQLCAT team is always fun too!

Just got my speaker feedback from SqlBits 9 for both my Always On session and my Dot.net session. Thanks to everyone who attended and filled out the feedback. It looks like my Always On Session was one of the top sessions at the event, and the Dot.net one was not far behind.

While the dot.net did not score quite as highly, the feedback was super positive and it looks like there is a real appetite for people who want sessions that focus more on dot.net than pure SQL Server.

image

Here are some of the feedback comments from the Always On Deep Dive

  • Amazing demo's. Bob is a complete guru. I learned a lot and was amazing at
    what he was able to cover in one hour. The only downside was that because
    there was so much, the pace was very fast.
  • This was a superb session. It answered every question I had about always-on.
    Bob knows his stuff inside out and managed to explain and build a working lab
    demo that clearly illustrated all of the important technologies, features and
    benefits, gotchas and other things to look out for. It was a lot to get through in a
    1 hour session but it was superbly done
  • Awesome demo. Bob actually had two "data centre's"(Laptops) and performed
    a real time planned and unplanned failover. So much could have gone wrong in
    that demo but it all went perfect. Excellent real world demonstration of Denali
    Always On.
  • Really good session. Can't wait to get my hands on Denali! Begone mirroring :)

image

Here are some of the feedback comments:

  • Excellent session, lots of detail and info on what to look out for in .Net apps to
    gain performance from SQL. Can definitely take this lesson and ensure our
    workplace is applying these rules.
  • As a developer this was the best session from both days for me.
  • This session was pure gold for me. The practical suggestions for checking
    query plan re-use etc were spot on. I've already had a meeting with my
    colleagues to pass on these pearls of wisdom. It's been a timely reminder for us
    to keep performance very much in mind, as we are just about to start a major
    new SQL Server project. Very useful.
  • Bob is a real SME... I don't like .Net, but Bob's style of presenting even inspired
    a sense of confidence in me!
  • More like this please

If you’ve been to the recent SQL 2012 Road show last week , you may have noticed that we were using CTP3 for the demos.

Well, release candidate 0 is now available for download, with more features for Power View and some of the items we demo’d

http://www.microsoft.com/download/en/details.aspx?id=28145

The Hyper- image with all the components pre loaded has not yet been updated, so if you can’t wait like us, you’ll need to start installing Winking smile

We've just finished the SQL 2012 Road show  featuring Always On, BISM, PowerPivot 2.0 and Power View (formally project crescent).

There are a few more features coming in RTM that we could not demo, but be aware that they will be adding value to what you can currently see. More details are available on the reporting services blog here http://blogs.msdn.com/b/sqlrsteamblog/archive/2011/10/13/power-view-pass-and-mobile.aspx 

1. Multi View

Charts can now be split up into multiple “regions” adding more options to data visualisation

2. Export to PowerPoint

I was a bit concerned this feature would be cut as it appeared in very early demos and then disappeared in CTP3, but good news is it looks like this feature is back to stay.

3. Self Service Alerting

From SharePoint you can now create alerts based on the data.

4. A Roadmap is announced for “mobile” BI to enable project crescent and other tools on mobile devices, even Apple iPads!! This wont be early 2012, but should be later in 2012 looking at the released roadmap.

A few people have asked for links to sample BISM data models and reports to demo Project Crescent or Power View.

There are two main choices

1. The official site has a Hello World Picnic or Adventure Works examples which are quite cute
http://www.microsoft.com/download/en/details.aspx?id=26718

2. You can download an entire VHD (needs Hyper-V) that contains the whole stack including the TailSpin Toys database, BISM project and sample reports. Be warned this is 60GB or so.

http://www.microsoft.com/download/en/details.aspx?id=27740

I’m using the Tailspin toys are the moment, but the Hello World Picnic is a much smaller download if you are not using the massive CTP image/VHD.

HTH,

Bob

SQL 2012 Road show

by Bob Duffy 8. November 2011 15:57

So far we have completed the SQL 2012 road show in Dublin and Belfast. Sandra has put some of the pictures up on the Prodata Facebook site here

The agenda for all shows is:

-SQL 2012 overview (15 mins)

-Always on Deep Dive (90 mins)

-Introduction to BISM (90 mins)

If you couldn’t make the road show, or have been to the road show and want to show some of the content to your colleagues I’ve uploaded the decks here:

I haven’t been following what is now called Data Explorer very well, but just seen a great demo

http://blogs.msdn.com/b/timmall/archive/2011/10/17/early-walkthrough-of-the-montego-client.aspx

Looks very interesting. Maybe this will be the future of ETL tools, or maybe this will become part of PowerPivot to improve the ETL capabilities which at the moment are pretty limited. for the moment is it effectively a cloud based ETL or data exploration tool.

According to the site it is due for release in November, 2011

http://www.microsoft.com/en-us/sqlazurelabs/labs/dataexplorer.aspx

We do a lot of code reviews and the use of SELECT DISTINCT always comes up as its picked up by many of the static code analysis tools as a known scalability and performance risk. The common question is “Why should I avoid distinct” and “How can I avoid it”

During a performance review we either Red Flag DISTINCT indicating that it is a severe performance issue, or orange flag it, meaning that its ok to keep it in the code, but consider avoiding this in future developments as its only slightly impacting performance and there may be bigger fish to fry performance wise.

To be honest, my main concern with select distinct is not related to performance it is more to do with the mind set behind distinct. A developer may have written a query seen that he has duplicate rows and rather than revisit the joins to see if he has joined to many tables, or if he can change a join criteria, he simply slaps a distinct on the query. So, a distinct on a high percentage of queries is a sign of “hiding” problems in query design.

 

Lets look at a few use cases. The terrible (red flag), The not optimal (orange flag) and the passable

1) Terrible. Using DISTINCT with expensive scalar functions or UDF’s

select distinct FirstName , reverse(Firstname) as MyFunction
from dbo.DimCustomer

image

In this case we are just using the replicate function, but often a customer may have far more expensive UDF functions (which by themselves are not so good for performance). The key point is that with DISTINCT, the scalar function has to be evaluated BEFORE the aggregate, so will be over the entire table, not just the few rows selected. On one customer engagement that was 100 million iterations when only seven rows were returned.

An alternative version of the same query is below. We can see that the Scalar function is now performed AFTER the aggregate. What difference does this make ? well it depends on the number of unique rows versus the number of rows in the table, and how expensive the scalar function is. So we cannot say that this is always a key issue, but its worth reviewing.

select FirstName , reverse(Firstname)
from
( 
select distinct FirstName 
from dbo.DimCustomer
) a

image

 

During a performance tuning engagement we will only red flag this as critical if the workload analysis puts the query as one of the top five statements by CPU, otherwise we will mention it, but try and aim for bigger fish.

Note that I mentioned UDF’s are bad. This is well documented elsewhere, especially by Simon Sabin. If there was a holy war against UDF’s Simon would be leading the charge!

http://sqlblogcasts.com/blogs/simons/archive/2008/11/03/TSQL-Scalar-functions-are-evil-.aspx

http://sqlblogcasts.com/blogs/simons/archive/2010/01/14/User-defined-function-performance-is-awful--Micorosft-please-sort-this-out.aspx

http://sqlblogcasts.com/blogs/simons/archive/2005/01/17/User-Defined-Function-performance-comparison.aspx

http://connect.microsoft.com/SQLServer/feedback/details/524983/user-defined-function-performance-is-unacceptable

 

2) Bad. Using DISTINCT with One to Many Joins

select distinct EnglishPromotionName
from dbo.DimPromotion p
inner join dbo.FactInternetSales s on s.PromotionKey=p.PromotionKey

image

In this case, we need to perform a join and a Aggregate and a sort. A much more efficient query is written below using EXISTS

select p.EnglishPromotionName
from dbo.DimPromotion p
where exists (select * from dbo.FactInternetSales s where s.PromotionKey=p.PromotionKey) 
image

Notice as because we use EXISTS we do not need the aggregate or the sort in the query plan, the exists will just return the first occurrence, which is much more efficient.

3 Passable. Using DISTINCT on a single table or with 1-1 Joins

select distinct FirstName 
from dbo.DimCustomer

image

 

In this case its not really possible to get a better query plan, is DISTINCT is “ok”. However we would often write this as an aggregate query with GROUP BY

select FirstName 
from dbo.DimCustomer
group by FirstName

image

 

Why would we use the group by ? Well, clearly not for performance as the plans are the same, the reason is simply that we know that static code analysis tools will pick up distinct as a potential bad practice and we don’t want to have to continually justify its use. The group by will squeeze pass code reviews without raising an alert. Even though its technically the same plan anyway Winking smile

 

4 The Unforgivable. Using DISTINCT to  Hide Gratuitous Joins

select distinct Firstname
from dbo.DimCustomer c
INNER join dbo.FactInternetSales s on c.CustomerKey=s.CustomerKey

Assuming that every customer had at least one sale (eg that's why they are customers!), the inner join is not needed so we can simply write

select distinct Firstname
from dbo.DimCustomer c

5) The looks bad but is actually ok one

select distinct Firstname
from dbo.DimCustomer c
LEFT join dbo.FactInternetSales s on c.CustomerKey=s.CustomerKey

In this case the left join is worthless as the we are only doing a distinct on FirstName, so you would think this will result in a horrible query plan. However, god bless the Query Processor Team, they remove redundancy joins from the query so the actual plan for this is as below:

image

 

Anyone have any more base/ good use cases for distinct I would love to hear about or add them.

 

Thanks,

Bob

Page List