Category Archives: Microsoft

Windows 8 sales figures point to sluggish start

Microsoft were looking for the arrival of Windows 8 to turn around the ongoing decline in PC sales, with the first sales numbers released, it looks like the hoped for turnaround hasn’t occurred…

Since the launch of Windows 8, sales of Windows devices in the US have dropped 21 per cent compared to the same time period last year, NPD said. Notebook sales dropped 24 per cent, but desktop sales fared a bit better with a smaller 9 per cent decline.

“After just four weeks on the market, it’s still early to place blame on Windows 8 for the ongoing weakness in the PC market,” Stephen Baker, vice president of industry analysis at NPD, said in a statement. “We still have the whole holiday selling season ahead of us, but clearly Windows 8 did not prove to be the impetus for a sales turnaround some had hoped for.”

A SQL Stored Procedure Parameter Sniffing Gotcha

This is another one of those occasional posts that is primarily for my own benefit to remind me of a particular problem, but that I’m posting publicly in case it could be of use to someone else.

On one of our systems we have a stored procedure to pull back all of the staff details for a particular project. Initially the screen used LINQ queries, but as anybody who has used LINQ can tell you in certain situations the queries it produces can become quite unwieldy and slow, so in places like that we’ve swapped to using stored procedures. The stored procedure is really simple consisting of one query that takes the two stored procedure parameters to identify the project the staff list is required for. Anyway, on our test systems the stored procedure has been running really well returning the staff details in under a second.

However that hasn’t been the case on the live system. The same query on our biggest project has been slow. Not just slightly slow, go make a cup of coffee (including picking and grinding the coffee beans), do the Times Jumbo Crossword type slow. But when you take the query that the stored procedure uses out and run it directly in a SQL Management Studio query window it returns in under a second, indeed if the same project in our User Acceptance Test server which is essentially an older copy of the live database returns in a similar high speed. It’s something in particular about the live server.

Not surprisingly this has caused a good deal of head scratching, but on Friday afternoon I finally solved the mystery and found what was causing the slow down thanks to this blog post.

To understand what is going on you need to remember a few things about how SQLServer works:

  • SQLServer processes queries differently depending on a number of factors including how many results it thinks the query is going to produce, the indexes on the tables, how the data is arranged in the tables and how the data is arranged on the disk to name a few.
  • When you create a stored procedure SQLServer builds these execution plans only once, the first time the query is run and uses these execution plans every subsequent time the stored procedure is called.
  • If you use a stored procedure parameter in a query within that procedure the query optimiser uses the values of those parameters in the execution plan, if you use local variables the query optimiser creates a more generic plan. (This is called Parameter Sniffing)

Having asked around, most SQLServer users are aware of the query optimiser, many are aware that SQLServer builds the query execution plan once – although they may not know exactly when, but relatively few, including a good few DBA’s will be aware of the difference in the way parameters and local variables are treated by the optimiser.

When you bear in mind that we have a mixture of different sized projects in our system, it starts to become rather obvious what has happened and why the query is running very slowly on one server but not on others. On some servers the first call of the stored procedure was for a small project, whilst on others it was a big project, as a result the SQLServer’s have created different execution plans and that is favouring particular project sizes. Unfortunately on the live server the query plan is totally unsuitable for the project with hundreds of staff members, hence the hideously slow performance.

All I did was change the parameters in the query to be local variables, and then set the value of those local variables to be the value of the parameters – two extra lines and a tweak of the query, and the query started returning in under a second as for all the other servers. By virtue of having a generic query plan the performance of the query is not going to be quite as good as one targeting a particular project size, but in a system where we are storing a wide variety of project sizes a generic plan is what is needed.

At this point, having found the problem I started looking at other stored procedures that could potentially exhibit similar problems – as a general rule I’d recommend not putting parameters directly into queries.

If you want a more detailed explanation, complete with a simple worked example of what to do, check out this SQL Garbage Collector post.

Microsoft Take On the iPad

Last night Microsoft announced their new tablet, the Surface. There is a good summary of the key points here: .

However it is an interesting move, as the article above says, this is a big change for Microsoft who aside from the XBox haven’t ever built hardware – you’ll never have seen a PC actually made by Microsoft for example. This however is how Apple have made their money and built their platform by tightly controlling everything.

There is still more we need to find out though, Microsoft haven’t talked prices, although we can take a fair guess that the price points will be competitive, and the release dates are a bit vague.

The other thing that may well cause confusion is that what they’ve announced is actually two machines, one is an ARM based iPad rival, the other is an Intel based PC that will be able to run normal Windows applications. Whilst you could say that Apple do the same with the MacBook Air which is a similarly portable computer, Apple clearly delineates the Air from the iPad.

Despite all the trumpeting, this is going to be a difficult sell for Microsoft, they are a long way behind, and maybe more so than in the phone market, iPad is synonymous with tablet, indeed much as people refer to vacuum cleaners as a Hoover, people refer to all brands of tablet as an iPad.

However it will certainly be a positive move if Apple has some serious competition, and whilst only time will tell whether this will be the tablet to really compete, this certainly seems to me to have a better chance as unlike Android and iOS devices there is a level of compatibility already with what is in use in corporate environments.

BBC News – Windows 8: Taking a look at Microsoft's latest operating system

If you’re wondering what all the fuss about is with Windows 8 it’s worth taking a look at this video from the BBC’s tech correspondent Rory Cellan Jones: .

You’ll see that what Microsoft are trying to do is produce an OS that will produce a tablet experience on iPad like devices, but also keep backwards compatibility with the familiar windows interface. Whilst it’s true that underneath MacOS X and iOS are the same, they are distinct entities, so on iOS you’re not going to find yourself dumped to a MacOS desktop which is something you’ll see in the video.

It remains to be seen how the average user will take to having both the Metro interface and a pointer based interface on the same device – certainly it seems like using old style windows touch based may be frustrating with small buttons designed for mouse clicking, as will using the Metro interface with a mouse.

Late to the Party – Windows Phone 7 Series

Yesterday afternoon the internet was buzzing with details of the launch of Microsoft Windows Phone 7 Series in Barcelona. Only it wasn’t really a launch, it was more a demonstration of a preview version of the platform. It’s predecessor was only launched last autumn, and this pretty well complete rewrite of the Microsoft mobile phone platform isn’t going to be available to buy until around the same time this year.

Whilst it certainly seems to have innovative features – a user interface that does things rather differently from the current favoured multiple pages of icon design that is almost ubiquitous, along with an XBox Live tie up to link your mobile and console gaming – it does seem a pretty brave move to show your rivals what you’ve got planned months and months before anything is going to be released. Even when you take into account that Microsoft are often much more open about showing preview releases of upcoming products than Apple for example, it still seems very early to be showing.

However, when you think about it, if Microsoft wants any part of the rapidly growing mobile applications market, it had to do something.

Microsoft, just like Nokia, Sony/Ericsson and all the rest were caught massively on the hop three years ago by the launch of the iPhone. Smart phones were very much of a niche market, and most regular consumers used a phone to make calls. It was possible to add applications onto smart phones, but again it wasn’t something that many people did.

Roll forward three years and the iPhone has really gone mainstream, it still surprises me how many people have them, and who they are. Many of them, even relatively non-technical are comfortable with the idea of adding applications, reading e-mail, browsing the web and playing games from a phone handset. On top of this Google has moved in on the market making waves with it’s Android operating system. Established players like Nokia have found their market share falling after years of failing to ignite the smart phone market.

Then we get to Microsoft.

They had a niche in corporate markets, and certainly I’d come across techies from time to time using (and more often than not cursing) their Windows Mobile handsets. The ability to program applications in the same languages as desktop applications certainly helped adoption. However they largely dropped the ball. Whilst they have carried on releasing updated versions of their platform they’ve largely been left behind, giving the impression – intentionally or not – that they weren’t interested, that they were happy to relinquish their market share to Apple and Google. In the corporate space Blackberry has grown, certainly in our company those users who are issued with a smart phone are issued with a Blackberry, and many of the executives ask for one by name. Any mobile applications would have to be developed for Blackberry, not Windows Mobile now, and Blackberry provide the tools to do that.

As I’ve said, the iPhone seems to have really gone mainstream, introducing a growing range of people to a smart phone, and the techie space seems to be being filled by Google Android. The iPhone is selling by the million, and producing billions of application downloads.

What Microsoft were showing looks interesting, and if they can sort out the reliability and stability problems that established wisdom say plagued previous versions it would be a good platform, but it would be a good platform if the phones were on the market now. Between now and release Apple, Google and the rest will certainly be releasing updated and new versions of their phones and software. The Microsoft gamble is that having seen the show yesterday, people will be willing to wait, and that come the autumn they will be willing to put aside the previous reputation for being buggy, put down their iPhones, Blackberry and Android phones, write off the money they’ve spent on apps for those platforms – or in the corporate environment infrastructure, and switch over to a Microsoft phone. I’m sure there will be a good few techies who will do so, but the average consumer or the corporate user? It remains to be seen.