Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Poor Little Misunderstood Views

Some people love ‘em, some people hate ‘em. But, one thing I have found to be nearly universal is that most people misunderstand how Views are used in SQL Server.

The Backdrop

A View is merely a pre-defined query that can be treated in many ways as a table. This… Read more

8 comments, 4,684 reads

Posted in SQL Coach on 29 July 2010

Implicit Data Conversion: The "HHidden" Bottleneck

Have you ever written a query that just seems to take forever? You have looked it over time and time again, and it seems to be perfect! It’s straightforward, has an appropriate index, and still takes 5, 10, 15 seconds… or even minutes?.

A common cause in this scenario is… Read more

0 comments, 546 reads

Posted in SQL Coach on 13 July 2010

WHERE to begin

Many people, once they start getting comfortable writing SQL, begin asking the same questions. One such common question is “Does the order I put stuff in the WHERE clause make a difference?” This question usually means different things to different people, so let’s dig in a bit.

There are often… Read more

0 comments, 542 reads

Posted in SQL Coach on 7 July 2010

Indexes are best utilized in WHERE, not JOIN

A pervasive oversight in database indexing by newer database users is relying solely on indexes used for joining tables together (i.e. foreign key indexes.) For example, say you have a Puppies table and a Kid table. Most likely, there is a Kid_ID column in the Puppies table pointing back to… Read more

1 comments, 863 reads

Posted in SQL Coach on 1 July 2010

Function Calls are Evil Incarnate

The following queries look extremely innocent. However, they are all application killers once the target table grows to more than a couple thousand rows:

Select Count(*) From Person_Data Where Upper(Name_Last) = ‘SMITH’

Select Avg(Collar_Size) From Person_Data Where dbo.MyFunc(Person_Data_ID) > 500

For each of these statements, a table scan will be… Read more

7 comments, 727 reads

Posted in SQL Coach on 28 June 2010

My SELECT statement has hung!

 One of the first roadblocks many developers run into when using SQL Server for the first time is firing off a query that simply selects data, and having the query never return a result. After spending several minutes of their precious life-force watching nothing happen, they get aggravated, cancel the… Read more

1 comments, 795 reads

Posted in SQL Coach on 24 June 2010

The Power of Indexes

Time and time again I have run into the scenario where a developer who is moving into using databases is not solid on what an index is or how to correctly utilize them. While this is well-worn territory for the DBAs in the crowd, it bears taking some time for… Read more

2 comments, 316 reads

Posted in SQL Coach on 22 June 2010

Killer I/O

Here’s a big statement


WHEN WRITING DATABASE QUERIES, 95% OF THE TIME THE BOTTLENECK IS IN THE I/O, not the CPU, and not the memory. Often, when queries run slowly, the newer database developer will suspect that the hardware is insufficient. While beefier hardware can make a dent, the well… Read more

4 comments, 329 reads

Posted in SQL Coach on 10 June 2010

A Guitar is Just a Piece of Wood

In my real-life I play guitar.  Being an analytical sort-of-fella I found myself inhaling all the books, videos, advice, etc. that I could muster.  One of the best pieces of advice went something like this (and it applies to SQL as well):

“A guitar is only a piece of wood… Read more

0 comments, 269 reads

Posted in SQL Coach on 8 June 2010

Catch Performance Issues Early!

I have posted this before elsewhere.  However, due to the frequency in which I come across this, I feel it’s worth reiterating…

This unfortunate situation arises all too frequently, and there is a relatively simple solution to it.

Often, everything performs well in your development/test environment because you have relatively… Read more

0 comments, 241 reads

Posted in SQL Coach on 3 June 2010

Performance Tuning Series

To kick off this blog, I am going to start with a topic that is hot on the mind of most developers who begin using databases in a serious way, and that is performance!

As developers begin using databases or scale up into applications that need to track a lot… Read more

0 comments, 257 reads

Posted in SQL Coach on 3 June 2010

The Nature of the Database-Driven Developer

Bear with me as I wax philosophical for two sentences.  Our societies are becoming more polarized with each passing day.  We see this in spirituality, politics, family life, and most other aspects of our lives.  As IT professionals, our careers are impacted by this polarization.  There are pressures for us… Read more

0 comments, 273 reads

Posted in SQL Coach on 3 June 2010