Sometimes, you hear of something and you think „that’s just what I need!“ only to find that in the real world „things are a bit more complicated than you think“
Is an example of this. At first sight I thought „why isn’t this the standard setting“ but this question-and-answer article might explain why…
via What risks are there if we enable read committed snapshot in sql-server? – Database Administrators Stack Exchange.
„If you are still facing SGAM contention then you can use trace flag 1118“ it says in the article.
This flag is often quoted as one you should set in order to improve sqL Server performance. To be fair, the flag used to have a lot more significance than it does today but nowadays, before knee-jerk reflex applying the flag you should first look at the performance counters to see if you are actually being slowed down by the thing this trace flag changes.
The key here is to look at your tempdb usage to see if you are getting any PAGELATCH_EX locks on the tempDB. If you aren’t then adding this trace flag might actually negatively impact the SQL Server performance as a whole.
By the way, the „SGAM“ referred to in the linked article is „Shared Global Allocation Map“ so as you might guess it’s a map of memory which is shared so there might be some contention if two or more processes are trying to get at memory in the shared allocation map at the same time.
The bottomline is, as so often, take a baseline, make the change if you find some cause to do so, check the results, and keep or reject the setting as appropriate.
via sql server trace flag 1118.
You might be able to tell that TempDB has been on my mind a bit lately. Unfortunately, TempDB is not the name of some person or social thing, it’s about work and the place where SQL Server stores its temporary stuff (and mine or any other SQL programmer’s stuff.)
In this webcast you get a pretty good idea of what you should do and look out for in your (if you have a SQL Server) Database environment. (And, nowadays, who doesn’t have a „database environment“? … comeone, sure you do… or?)
How to Tell When TempDB is a Problem: Webcast Video – Brent Ozar Unlimited® by Brent Ozar Unlimited®.
Poor SQL – Instant Free and Open-Source T-SQL Formatting.
You know those times when you’re having to work on someone else’s computer and you have to either write or understand some SQL Code and it looks like a dog’s dinner. Well, you can use this free website as a tool to clean up your code formatting or even to make it more unreadable.
Works better than some tools from bigger name companies, in my opinion. Keep it in your toolbelt.
If you’ve never come across SQL Server trace flags then don’t worry, you’re not alone and most of the time no one in a normal scenario needs to know such beasts exist.
There are some occasions when an obscure (even more obscure than the whole topic is anyway) trace flag might help.
In this case the article descibes a trace flag with questionable value.
Having to extend one file can be bad enough but then having to expand all files in a file group can *really* hurt.
Naming conventions are poison. | Facility9.
In this article Jeremiah Peschka speaks from my heart. One day I hope naming conventions are going to go the way of … well … one of those things that went obsolete because technology moved ahead. (As a shining example, the A20 gate in x86 Processors. This was a hack when first introduced but it was a hack that stuck.) The rest of the computing environment changed so much that the A20 Gate became more trouble than it was worth. That’s how I feel abut naming conventions, causing more trouble than they are worth because the tools do a much better job of telling us what something is than messing with the name ever could.
I can, through my current work, now add some new hated naming conventions to my growing list. This one’s not a full grown hate, more an annoyance, but I don’t like naming an instance according to the version of SQL Server running it. It becomes tedious for everyone come the day that the old version is end-of-lifecycle.
The actual title of the piece is:
But I think the essence is in a subtitle: Write Queries Organically
via How I Get By Without sysadmin | Facility9.
If I had my way, anyone who touches a SQL Server (that I have some responsibility for) would have to sign a declaration that they have read this article and pledge an oath to abide by it.
Similarly, anyone coming to complain about the SQL server being slow would have to provide a written explanation as to why they can’t improve the execution plan of the top three most expensive queries. Anyone caught with a 1,5GB heap table will be made to do the top ten most expensive queries before we even think of checking any performance counters.
Of course, the SQL Servers we’re talking about are never going to be perfect (not for the price the Business Partners are willing and able to pay) so there will often be something the DBA can do to improve performance or something they can suggest to the developer and/or user which would improve performance. However, going straight to the DBA without checking the basics is like calling the electrician when your TV doesn’t work because the batteries in the remote are dead. Unnecessary expense and possibly even ridicule may occur.
Yours, 100% friendlywise, A
My metaphor is a diner. The Resource Diner.
via Adam Machanic : How Queries Are Processed (A Month of Activity Monitoring, Part 13 of 30).
I love this visualisation of how delays can happen during the processing of a query.
It reminds me of another metaphor. Earlier in order to have more performance in a car, you would simply add more cylinders to the engine (add more CPUs) or increase the size of each cylinder (increase clock speed) or pump in more fuel add memory.) Nowadays you have fuel injection systems adding the fuel under higher pressure and in more than one squirt, and you have multiple turbo-/superchargers, and modulated ignition sparks, and a whole host of other things. So, you really do have to be a rocket scientist in order to know which dial to turn in which direction and how far in order to improve performance in each and every scenario.
Everybody’s worried that adding memory is somehow cheating.
Says this article:
via Using Memory for Performance Tuning in SQL Server by Brent Ozar Unlimited®.
I can’t say I’ve ever heard that worry expressed in that way. I hear one group worried about the price of adding memory. I hear one group worrying that adding memory will just delay the onset of the problem and that as the data volume increases, there will come a time when you can’t chuck memory at it anymore and the Godzilla like table/query will eat your performance.
We had a classic example the last few days. Customer screaming for blood because his tool is unusable and everyone passes the buck down the line until it stops where the poor sucker has no one to pass it on to. The louder the screams the more it will spread and the more „the buck stops here“ points/people will get hit with the stuff flying off of the fan.
So, we do traces and Perfmons whilst a precursory look at the database reveals a few heap tables with a Gigabyte of data each that are getting hit pretty often. It doesn’t take much thinking to realise that you can throw memory at the problem to get the heaps into memory or you can get indexes added and if still necessary, add memory. Adding an index is not exactly rocket science but the developer had previously tried to bully the assembled crowd with loud assertations that with all their years of experience they have optimised their indexes until there’s nothing more to be won. At this point a gentle suggestion that a few indexes must have then gone missing scince a 1.5GB indexless heap table would be one of the most obvious signs of poor database design, allowed the poor fellow to save some face and to later admit that some indexes must have gone missing in the porting process from MySQL.
The fact that the porting from MySQL to MSSQL was done using a Microsoft migration tool and that there were ample, but unheeded, warnings to check that all design structures had been ported/migrated can, of course, be put down to a blustering answer of „well we can’t check everything can we?“. The bluster is of course true, I cannot expect them to check that the moon is not made of green cheese or where the first occurence of my telephone number within the decimal expression of PI happens to be, but from my position, I do believe that if someone has a problem with „my“ product then I do think it is my duty to check that I have my house in order before I try to shovel the blame on someone else…
Free eBook – 119 SQL Code Smells.
This is quickish PDF Format reference, from red-gate, shows various things which you should, or should not, do to avoid „experts“ wrinkling their noses at your SQL Server environment(s)