SQL Server 2008: Query Hash Statistics

Bart Duncan has released a very useful addition to the DataCollector capture/reporting abilities of SQL Server 2008. Query Hash Statistics can do low-overhead query cost monitoring, utilising the query fingerprint and query plan fingerprint (aka query hash/query plan hash) features that were added in SQL Server 2008. Query fingerprints enable you to get the cumulative cost of all executions of a query even if the query is non-parameterized and has different inline literal values for each execution. Previously, the only way to get this type of query performance data was to capture a Profiler trace and run the trace through a post-processing tool.

Once installed, and sufficient data has been collected, you can access the collected information via 2 custom reports.

queryHash1

Perth .NET User Group Meeting: 6pm Thurs, 12th May: Introduction to the .NET Reactive Extensions (Rx) with Lee Campbell and James Miles

Join us at the Perth .NET user group, Thurs May 12th (6pm) where Lee Campbell and James Miles join up to present an Introduction to Rx, aka the .NET Reactive Extensions. Rx is a product from Erik Meijer’s team at Microsoft that allows you to compose asynchronous and event based programs using observable collections and a Linq style syntax.

The presenters will guide you through the background and basics of Rx, and introduce you to the terminology that is peculiar to Rx. James and Lee will compare code written with and without Rx and show case code to demonstrate the power of Rx in the areas of resource management, fluent and familiar Linq syntax, composable nature, testability of asynchronous and concurrent queries, and the and the ability to tame side effects.

  • TOPIC:  Introduction to the .NET Reactive Extensions (Rx) with Lee Campbell and James Miles
  • DATE:   Thursday, May 12th, 6:00pm – 7:30pm
  • VENUE: Enex 100 Seminar Room, Level 3, 100 St Georges Terrace, Perth
  • COST:   Free. All welcome

I’m under strict instructions to ask everyone to come armed with questions about Rx!

Please Note: this talk will start at 6pm (not our usual time of 5:30pm due to the venue’s availability)

Full details here: http://perthdotnet.org/blogs/events/archive/2011/05/07/introduction-to-the-net-reactive-extensions-rx-with-lee-campbell-and-james-miles.aspx

Reminder: Perth .NET User Group: ASP.NET MVC framework with Michael Minutillo

Scott Hanselman is fond of saying that programming components are like Lego pieces and right now “the lego pieces coming out of Microsoft are the right size”. One important piece of the web stack is the ASP.NET MVC framework. Since its initial release in March 2009 there has been a new version of the framework released every year and it has quickly become the platform of choice for .NET developers creating web sites. January 2011 saw the version 3.0 release which introduces a number of changes and new features. Additionally, at the MIX11 conference earlier this month Microsoft released the “MVC3 tools refresh” which make developing MVC3 applications in Visual Studio 2010 a highly productive experience.

Join us at the Perth .NET user group, Thurs May 5th, where we will look at the new Razor View Engine, Unobtrusive Javascript, Integrated Scaffolding, better support for IoC integration. We will also touch on SQL CE 4, NuGet and Entity Framework 4.1 (Magic Unicorns Editions). Come and see the Lego pieces and be inspired by what you can build.

  • TOPIC:  ASP.NET MVC framework with Michael Minutillo
  • DATE:   Thursday, May 5th, 5:30pm – 7:00pm
  • VENUE: Enex 100 Seminar Room, Level 3, 100 St Georges Terrace, Perth
  • COST:   Free. All welcome

Mike Minutillo is .NET software engineer with a B.Sc. in computer science. In 2000, Mike started writing .NET software to fund his university studies and has been an active member of the .NET community ever since. Mike is a regular attendee at the Perth .NET Community of Practice where he has given presentations on new features of C#, ASP.NET MVC and Test-Driven Philosophy. In 2009 he started the Perth ALT.NET user group which meets monthly to discuss software engineering tools and practices in the .NET development space. Mike is co-author of Professional Visual Studio 2010. He maintains a technical blog at http://wolfbyte-net.blogspot.com/ and can be contacted at http://twitter.com/wolfbyte/.

There will be a door prize of a choice of license from JetBrains (one of ReSharper , TeamCity Build Agent, dotTrace Profiler, dotCover , RubyMine, IntelliJ IDEA, PyCharm).

When to avoid CQRS

Interesting post from Udi Dahan (who was previously an exponent of CQRS):

“It looks like that CQRS has finally “made it” as a full blown “best practice”.

Please accept my apologies for my part in the overly-complex software being created because of it.

I’ve tried to do what I could to provide a balanced view on the topic with posts like Clarified CQRS and Race Conditions Don’t Exist.

It looks like that wasn’t enough, so I’ll go right out and say it:

      Most people using CQRS (and Event Sourcing too) shouldn’t have done so.

Should we really go back to N-Tier? When not using CQRS (which is the majority of the time), you don’t need N-Tier either…

. . .

In Summary

So, when should you avoid CQRS?

The answer is most of the time.”

SQL Server: How to Share Data Between Stored Procedures

Erland Sommarskog has an excellent SQL Server article “How to Share Data Between Stored Procedures” tackling these two questions:

  • How can I use the result set from one stored procedure in another, also expressed as How can I use the result set from a stored procedure in a SELECT statement?
  • How can I pass a table as a parameter from one stored procedure to another?

He discusses several methods, and points out their advantages and disadvantages. [Adding here so I remember where to find it in future!]

SSMS Table Column List Tip

On occasion, you will be at someone’s desk, looking over their shoulder when you suddenly notice something and exclaim “Hold on! How did you do that?” quickly followed by “I can’t believe I didn’t know about that!”.

I had just such an experience a few days ago. At the risk of being the last person to know this: in SQL Server Management Studio Object Explorer: open a Database, open the Tables folder, and open a Table. Left click on the Column list folder, and drag and drop to an open query window: you get a comma separated list of column names.

In the past, I had always right-clicked on the table, selected Script->Create To->New query window and then edited out the list of columns.  D’oh!

Reminder: Perth .NET User Group Meeting: Thurs 7th April, 5:30pm: LightSwitch- with Andrew Coates

Join us at the Perth .NET User Group Thurs, April 7th where Andrew Coates will demonstrate LightSwitch, a new product in the Visual Studio family aimed at developers who want to easily create business applications for the desktop or the cloud. LightSwitch simplifies the development process by letting you concentrate on the business logic, while LightSwitch handles the common tasks for you. In this demo-heavy session, you will see, end-to-end, how to build and deploy a data-centric business application using LightSwitch. We’ll also go beyond the basics of creating simple screens over data and demonstrate how to create screens with more advanced capabilities

  • TOPIC:    LightSwitch with Andrew Coates
  • DATE:     Thursday, April 7th, 5:30pm – 7:00pm
  • VENUE:   Enex 100 Seminar Room, Level 3, 100 St Georges Terrace, Perth
  • COST:     Free. All welcome

Andrew Coates is a Developer Evangelist for Microsoft in Australia. Before joining Microsoft, Andrew was an independent consultant specialising in database applications using Microsoft technologies including SQL Server, Visual FoxPro and Microsoft Office. Andrew’s wide range of experience includes telecommunications, SMB inventory, dispatch and accounting systems, using both web and rich client front ends. He has developed and delivered class room training and has mentored a number of developers in Visual FoxPro and SQL Server technologies. Andrew has spoken at international conferences on Geographical Information Systems, health statistics and database maintenance and is a regular presenter at TechEd both locally and internationally. An MCPD, MCTS and MCSD, Andrew also holds a Masters degree in Civil Engineering. Andrew blogs at http://blogs.msdn.com/acoat

Useful Codeplex Libraries

I recently came across two useful codeplex libraries. The first enables you to create advanced Excel 2007/2010 spreadsheets without Office installed, EppPlus:

EPPlus is a .Net library that reads and writes Excel 2007/2010 files using the Open Office Xml format (xlsx).

The second is a .NET wrapper of the ImageMagick image manipulation API, ImageMagick.NET