Today was the 2nd day of the SQL PASS conference, and as always there was a keynote. Todays keynote was by Douglas McDowall who is the VP of Finance, Thomas LaRock who is the VP of Marketing, followed by Dr. David Dewitt from Microsoft.
Douglas talked to the members at large about the financial health of the PASS organization. PASS is proud to now have a $1M rainy day fund so that we can survive though rough years like the years that we had a few years ago.
Bill Grazino took the stage for a few minutes in order to thank out going board members Rushabh Mehta (Immediate Past President), Douglas McDowall (VP of Finance) and Rob Farley (Board Member).
When Tom LaRock took the stage he started by introducing the new members to the board of directors which included Jen Stirrup, Tim Ford and Amy Lewis. For the PASS BA Conference we are moving to San Jose during May 7-9th and for the PASS Summit we will be back in Seattle from November 4-7. Early Bird registration will only be open until mid-December, so if you plan to sign up for the early bird rate, be sure to sign up soon at sqlpass.org.
Dr. David Dewitt took the stage and started his keynote, which this year is all about Hekaton (aka. In Memory OLTP Tables). Hekaton is a memory-optimized yet fully durable high performance OLTP engine which has been integrated into SQL Server 2014. For Hekaton Microsoft did a major rewrite of the core engine of SQL Server to fit this new engine into the existing database engine as they didn’t want to introduce a new Windows service to run this new In Memory database engine.
On of the primary reason that Hekaton is so fast compared to the traditional database engine is because of the lack of latching and locking as they don’t exist when using Hekaton tables. This is the core reason that Hekaton is able to get very close to being 100 times faster than the normal database engine.
Dr. Dewitt explained how latches work for those who aren’t used to looking at latches. Latches are used as a special kind of lock which are used to ensure that a process that is attempting to query for a page which is in the process of being read from the disk has to wait until the page read from the disk has been completed by the storage engine of the database engine.
One question that Dr. Dewitt gets asked a lot, and that I’ve been asked several times as well, is “is Hekaton the new pinned tables”? The answer here is no. Hekaton is a totally different way of processing data. By simply putting tables into memory and pinning the table there you wouldn’t even be able to get a 10X performance improvement which wasn’t enough to justify the time and money which Microsoft wanted to spend while making this product. Hekaton is actually the third query engine in the SQL Server database product. There’s the normal relational engine which we’ve been using for years, the ColumnStore engine (project Apollo) and not the Hekaton engine for these ultrafast database engine.
When building a Hekaton engine you MUST have a PRIMARY KEY defined on the table which is nonclustered and must be HASH or RANGE defined. For v1 there are no blobs and no XML data types available for Hekaton tables, which will hopefully be fixed in the release after SQL Server 2014.
Some of the big changes in the way that Hekaton handles data changes without locking is to change the way that updates are done. The big change here is that when an UPDATE is run the row isn’t actually change. A new row is added to the table and the old row is “expired”. This expiration is done by marking a timestamp of sorts (it’s closer to a transaction ID than a timestamp) as the last transaction which the old version of the row is valid for and when the new version of the row is written it is marked as having a beginning timestamp of the transaction time when the transaction was started. When select statements are accessing rows they use this timestamp to figure out which version of the row they should be looking at. This is a VERY different way of managing changes in the database tables from what we have had until now.
When are older row versions deleted? There’s a garbage collector which runs in the background watching for when there are rows which are expired with an earlier timestamp than any of the current transactions. At that point the old version of the rows can be deleted. This means that there’s no blocking that can possibly happen (if there was blocking in Hekaton tables) while this is happening as there are no transactions which could possibly read these older rows. Based on this is someone was to begin a new transaction and never commit the transaction none of the older rows would be able to be deleted.
I hope that you enjoyed the keynote from Dr. Dewitt as much as I did, and hopefully I’ll see you at the summit next year.
Every once in a while you run across a problem that shouldn’t be causing people as much problems as it is, yet there it is causing all sorts of problems for long enough that being broken is considered normal.
In the case of this one client that I’ve been working with that problem was massive delays in replication between two SQL Server 2008 R2 machines. And by massive delays I’m not talking about a few minutes, but hours, sometimes up to 10-12 hours of delay and it would be like that for days or weeks.
The symptoms in this case were that when you inserted a tracer into the replication publication the bulk of the delay was between the publisher and the distributor. That meant that odds are it was one of three thinks.
- The disk on the distribution database is crap
- There is something very wrong with the transaction log on the published database
- There is a network problem between the publisher and the distributor
Well in this case #3 doesn’t apply as the publisher and the distributor are on the same machine. Looking at the IO the response times were fine, between 0.001 and 0.015 seconds according to perfmon. There weren’t any major waits problems showing up when looking at the waits. That basically removes #1. So by process of elimination that leaves us with #2, something is very wrong with the transaction log.
Upon first look there’s nothing funky going on. Database is in simple recovery. The transaction log is huge, but with all these problems that’s to be expected. Running DBCC LOGINFO showed me some very useful information, when it finely finished (which was my next clue this was the problem). When it finished there was over 24,000 Virtual Log Files (VLFs) within the transaction log file.
Ladies and gentleman we have a winner!
Now fixing this on a machine which has replication which is as pissed off as this machine does isn’t as simple as just shrinking the log file. Because the replication is keeping a massive amount of transaction log space locked up this required some careful planning. The first step is to give the transaction log some nice big VLFs to write data to, but we need to do this somewhere that isn’t going to impact the cleaning up of the existing VLFs. The option here, add another transaction log file to the database. Grow it large enough to handle all the traffic for a day or two and grow it out in 8000 Meg chunks. In this case I grow it out to 56000 Megs in size. Then I left the system to sit there for a day.
When I came back to look at the system the next day replication performance was still awful, but now when I looked at DBCC LOGINFO all the VLFs which were in use were in the new data file. Every VLF in file #2 (the default transaction log file) was marked as status 0. A quick DBCC SHRINKFILE statement then growing the default transaction log file back out to it’s needed size of 56000 Megs and suddenly we were down to ~250 VLFs give or take.
Within about 2 hours replication had completely caught up and written all the transactions not only to the distribution database but had also written all those transactions to the subscriber as well.
Once replication was done I shrank the new transaction log file which I had created as small as it would go so that the next VLF that would be written to was in the default transaction log file. Once all the VLFs in the new transaction log file were back to status 0 I simply deleted the new file.
Now replication is all happy. I’m no longer seeing messages like “The Log Reader Agent is scanning the transaction log for commands to be replicated. Approximately 500000 log records have been scanned in pass # 3, 0 of which were marked for replication, elapsed time n (ms). When I started all this these messages were being thrown several times a second. Now they aren’t appearing at all which is very good.
Replication is happy, the client is happy, and I’m happily working on their next problem.
P.S. While this may not be your problem if you are seeing this sort of issue, it’s VERY much worth checking out.
Recently I had to move the SCCM database for a client of mine. I used this walkthrough to go through the process. For the most part everything worked pretty well. There was one thing which was missing from this. The process requires that the SQL Server 2008 R2 SP1 Feature Pack (or the feature pack for which ever version of SQL Server you had installed before) in the same location that the MSI packages were located in when SCCM was first installed. This means downloading and saving the MSIs in the correct location as needed.
Hopefully if you have to move your SCCM database you won’t spin your wheels like I did.
So I was doing a little performance tuning of a query for a company recently and we were getting hammered on the IO for the query. The query was in a stored procedure which wasn’t all that complex (ignore the crap code for now).
ALTER PROCEDURE [dbo].[iu]
[TimeStamp] = @t
(@p IS NULL OR p = @p)
(@as IS NULL OR [I_ID] IN (
select [I_ID] from [iq]
where [qt] in (select [tn] from [lqt] where [as] = @as)
and not exists (select * from [ia] where [Q_ID] = [iq].[Q_IQ])))
At first glance the plan looked fine. There was a scan on lqt, but that’s OK it’s a really small table. IQ was showing 77315 logical IO with a scan count of 15. So something is very wrong here. Looking at the plan a little deeper we see that while there is an index seek, we are seeking against that index over 6700 times each time the stored procedure is run. That sure isn’t a good thing. The index that we were seeking against was built on the I_ID column which while producing seeks with a ton of other columns included, was producing WAY to many seeks.
Our solution in this case was to build an index on the QT column and include Q_ID and I_ID columns. Once we built this new index the IO dropped from 77315 IO down to just 4368 which is basically the size of the table. The new index is being scanned, but it’s only being scanned once with SQL getting everything that it needs from that one scan.
So just because you are getting seeks in your execution plan that doesn’t mean that you are done tuning the query. You need to look at how many times each operator is being used, and fix any operators that are being executed to many times.
Getting the query a little better took a little code research in the application with the developer, but we were able to get things even better with just a slight code change. Apparently the “@as IS NULL OR ” section isn’t possible any more as the @as parameter will always have a value assigned so this fork of code is in there for no reason. Removing this from the query got the logical reads for that table down to just 30, reduced the worktable IO and lowered the IO on the ia table as well. All in all not bad for a few minutes of tuning and for putting an index scan in place.
This video is sponsored by Denny Cherry & Associates Consulting
Just a reminder that TODAY is my SQL PASS Summit 1st Times Webcast for the 2013 PASS Summit. The webcast is at 1pm PST / 4pm EST. I’ll be using GoToMeeting this year, and the URL for the webcast is https://attendee.gotowebinar.com/register/4906797491661003009 (THIS URL HAS BEEN CHANGED). Just sign in at the meeting time (or just before) and you’ll be all set.
If you’ve never been to the PASS Summit before then this webcast is for you. During this webcast I’ll be covering things like getting from the airport to the hotels, which hotels are nearest the convention center, where things will be inside the convention center, where the good food options are, where the good drinking options are, as well as some special announcements.
If you have been to the PASS Summit before then this webcast is also for you. This year the PASS Summit is in a brand new city, so there’s going to be all sorts of good information in this session about our host city Charlotte, NC.
See you at 1pm.
I end up VPNing into a lot of different companies networks, and the thing that I see that always kills me is when I VPN I’m given an SSL URL to connect to in order to get connected, but before the site appears I get a security warning that the SSL certificate isn’t trusted for that URL.
The entire point of SSL VPNs is that it makes a secure trusted SSL encrypted connection between you and the company network. If the SSL certificate isn’t trusted then there’s no way to know that the certificate was actually issued to protect this network. In other words there’s no way to be sure that there’s no man in the middle attack going on where all the network traffic to the VPN is being sniffed.
So I beg, I implore you … if you are going to use being some sort of SSL VPN spend the couple hundred bucks and get a proper SSL certificate for it so that you know you can trust the connection.
It’s a little late in coming, but I’m happy to announce that I’ll be presenting my SQL PASS 1st Timers webcast for the 3rd year in a row. The webcast will be via GoToMeeting this year. The webcast will be on September 25th, 2013 at 1PM PST / 4PM EST. Just fire up the old web browser at that date and time and go to https://global.gotomeeting.com/meeting/join/437424021 to get into the meeting.
I’m sure that someone will ask, so I’ll throw it out there now. The session will be recorded in case you can’t make it.
During the session some of the stuff that we will be going over includes:
- Where things will be laid out in the convention center
- Where the food in the area will be
- Where the drinks in the area will be
- Getting to/from the airport
- Some tourist stuff to do in town if you’ve got the time
- SQL Karaoke announcements (like always)
- Some other great stuff that’s happening this year
Now if you’ve been to the SQL PASS Summit before that doesn’t mean you can skip this session this year. We are in a new city for the first time in years, so it’s a whole new conference for us this year.
I’ll see everyone on the 25th.
Recently I had the privilege of traveling to Poland for SQL Day 2013. As always the people running the conference threw a great event. For this trip I got everything booked through the conference’s travel agent to setup the flights. This is a mistake that I will not be making again. When the travel agent booked the flight it was booked via the Polish airline called LOT. They serviced it out to Lufthansa, who purchased tickets on United for me. Not in theory this should have all gone just fine as they are all Star Alliance partners. However everything completely fell apart.
As we were about to leave from Los Angeles, CA to head to Europe (via Chicago) all of my wife’s Lufthansa tickets were canceled so United couldn’t issue tickets. We were then told to contact the travel agent and have them look into it. Slight problem with this plan, the travel agent is in Poland.
So we called the United 1K desk (for people who fly way to much like I do) and had them look at everything. According to them everything looked fine, except that by now we had missed our first flight. United told us to go to Lufthansa and have them issue new flights. Thankfully Lufthansa flies from Los Angeles so we simply walked over to Lufthansa in the International terminal and talked to them. They said that everything was still screwed up and that we needed to talk to United. United then said to call the travel agent. We got ahold of the travel agent who said that everything looked correct.
Eventually between United and Lufthansa we got tickets issued for a flight 12 hours after we were supposed to leave. This only took 4-5 hours on the phone with United (and at least two United employees) and the help of two Lufthansa employees at the Lufthansa desk at LAX (and several Lufthansa employees that were called by United).
So we make our way to Poland and enjoy our time at the conference.
Friday afternoon we check out flights (we flew out on Sunday) and everything was totally screwed up even further. I was taking different flights then I was booked on before, and Kris only had a flight from Poland to Germany and no flight home to the US from Germany. Needless to say this was a problem.
So I called United and was told that because it was booked through a travel agent I needed to go through them. So we called the travel agent again and was told that everything was fine.
I called United back, again, and was again told to call the travel agent. At this point I was pretty pissed (is there a polite way to say that I lost my shit?). I told the poor soul at United that I’d spent close to 10 hours on the phone with United for just this trip, and that if he couldn’t fix it to find me someone who could. We passed me off to a supervisor who reviewed everything (this was the second supervisor that I’d spoken with for this trip, the first being when getting the mess in Los Angeles fixed). She saw all sorts of problems and immediately began making phone calls to Lufthansa and Lot to get it fixed. And thankfully she didn’t take no for an answer but instead explained the situation to the staff at those airlines and was able to get us booked on flights home, the same flights home at that.
All in all if this hadn’t been booked through a travel agent I would have ended up saving myself probably a good couple of hours of running around trying to call different people.
Personally I’ve never seen the point of using a travel agent to book flights and hotels before. I can easily enough get access to all the information for all the airlines and hotels just by looking at their websites and making all the needed reservations online. I get that in the past a travel agent would have been handy as there was no Internet to use all this with, but in the modern day I can do things faster and easier by my self with the “help” of any travel agents. And in this case if I had gone with what the travel agent had said, I never would have left Los Angeles, and if I had my wife Kris never would have made it back home.
Let my nightmare be a lesson to you. Don’t use a travel agent. Book directly with the airline and be done with it.
It isn’t like this is the first time that a travel agency has screwed me either.
That’s right, next month I’m giving a post con at the SQL/Dev Connections conference. The post con is titled “SQL Server 2012 in a Highly Available World”. In this full day session we will look at all the high availability options which are available to you with SQL Server 2012 (and below) as well as some of the changes coming in SQL Server 2014.
If you haven’t signed up for SQL Connections yet I’d really recommend it. There’s a great group of speakers who will all be presenting top tier sessions and you can quickly add on both a pre-con as well as a post-con to get the maximum amount of training possible in one day.
I look forward to seeing you in Vegas in September.