SQL XEvents https://sqlxevents.com/ Thu, 31 Mar 2022 18:35:11 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.7 https://sqlxevents.com/wp-content/uploads/2019/07/fav.png SQL XEvents https://sqlxevents.com/ 32 32 176530083 Checkpoint Analysis: Your Exclusive How-To with XEvents https://sqlxevents.com/checkpoint-analysis-your-exclusive-how-to-with-xevents/?utm_source=rss&utm_medium=rss&utm_campaign=checkpoint-analysis-your-exclusive-how-to-with-xevents https://sqlxevents.com/checkpoint-analysis-your-exclusive-how-to-with-xevents/#respond Fri, 14 Jan 2022 21:27:17 +0000 https://sqlxevents.com/?p=1751 Checkpoints are essential in SQL Server to help with the durability and reliability of data persisted in the database.

The post Checkpoint Analysis: Your Exclusive How-To with XEvents appeared first on SQL XEvents.

]]>
Checkpoints are essential in SQL Server to help with the durability and reliability of data persisted in the database. When done right, you barely even notice the checkpoint and performance is groovy. Sadly, checkpoints can be a symptom of a problem and poor performance.

Checkpointing in SQL Server can have an impact on performance. Most of the time, DBAs don’t bother to think about checkpoints or their behavior. This isn’t necessarily a bad thing. It’s just a fact of life.

Much like the DBA, most of the time, checkpoints have no reason to be in the foreground of thought. This just simply means that things are running smoothly and we can occupy ourselves with other tasks.

When odd behaviors start to pop up such as the dreaded checkpoint io storm or the Flushcache (here or here) error, you need to have some tools to help you try and troubleshoot the issue. This article will help you add at least one more tool to your SuperStar DBA Toolbox.

Let’s start with a bit of background on what a checkpoint is.

Checkpoint Primer

A checkpoint is basically the last known good mark (or point) from which SQL Server can start applying changes registered in the transaction log during recovery after an unexpected shutdown or crash.

What is it that the checkpoint does? The checkpoint process is the means by which the dirty pages (modified data pages in memory) are written and persisted to disk. This process also takes the transaction log information and persists that to disk, while also adding a note to the transaction log of what was done.

The post Checkpoint Analysis: Your Exclusive How-To with XEvents appeared first on SQL XEvents.

]]>
https://sqlxevents.com/checkpoint-analysis-your-exclusive-how-to-with-xevents/feed/ 0 1751
Bulk Insert – Insights That Will Make You Drool https://sqlxevents.com/bulk-insert-insights-that-will-make-you-drool/?utm_source=rss&utm_medium=rss&utm_campaign=bulk-insert-insights-that-will-make-you-drool https://sqlxevents.com/bulk-insert-insights-that-will-make-you-drool/#respond Fri, 07 Jan 2022 18:16:58 +0000 https://sqlxevents.com/?p=1724 Bulk insert can be an extremely helpful tool to help ingest data into SQL Server efficiently. Sometimes, it is necessary to capture metrics in regards to the bulk insert in order to understand the who, when, and potentially why related to the insert process.

The post Bulk Insert – Insights That Will Make You Drool appeared first on SQL XEvents.

]]>
Bulk insert can be an extremely helpful tool to help ingest data into SQL Server efficiently. Sometimes, it is necessary to capture metrics in regards to the bulk insert in order to understand the who, when, and potentially why related to the insert process.

Many moons ago, I worked with a client issue in regards to performance issues stemming around linked servers. From that work, I shared an article about monitoring linked servers.

Also stemming from that work was a clear pattern that there were some issues also relating to bulk inserts. This experience helped me to generate a means to monitor and trap useful data while troubleshooting. From this monitoring solution, we were able to isolate specific processes for the client to help improve performance.

In this article, I will share the solution that I created through the power of Extended Events.

Bulk Insert Monitoring

When you are looking to trace for bulk inserts via Extended Events (XEvents), it is crucial to remember that there are multiple events. In addition, there are multiple means to perform a bulk insert. I show three methods to perform a bulk insert in my demo script.

The bulk insert methods I will explore are BCP, BULK INSERT, and OPENROWSET(BULK). Each has advantages and disadvantages, none of which I will explore in this article. Suffice it to say that each has slightly different uses and it is worth testing them to see which works best for your needs!

Bulk Events

Extended Events gets more and more powerful with each update to SQL Server. Sometimes this is demonstrated through the addition of certain events. …

The post Bulk Insert – Insights That Will Make You Drool appeared first on SQL XEvents.

]]>
https://sqlxevents.com/bulk-insert-insights-that-will-make-you-drool/feed/ 0 1724
Azure DB – A Quick Spelunk Into XEvents to Love https://sqlxevents.com/azure-db-a-quick-spelunk-into-xevents-to-love/?utm_source=rss&utm_medium=rss&utm_campaign=azure-db-a-quick-spelunk-into-xevents-to-love https://sqlxevents.com/azure-db-a-quick-spelunk-into-xevents-to-love/#respond Sun, 02 Jan 2022 00:23:00 +0000 https://sqlxevents.com/?p=1660 This is a very simple introduction into the creation of an Extended Event session using a template for Azure SQL DB.

The post Azure DB – A Quick Spelunk Into XEvents to Love appeared first on SQL XEvents.

]]>
This is a very simple introduction into the creation of an Extended Event session using a template for Azure SQL DB. I demonstrate the use of the GUI to configure the session quickly. After which I then script that configuration before creating the session.

The Cloud

It has been a minute since I gave much love or attention to Extended Events in Azure SQL DB. Things have changed a touch since then. We will see about some of those changes in a future article. As for this time, let’s focus on how to get a session in Azure SQL DB up and running really quick and easy.

Create a Session in Azure

I am going to keep this as easy as possible for creating a session and thus I will demonstrate how to do it from the GUI. And for those more in tune with their scripting side, there is a future article on that as well as a glimpse of a script near the end of this article.

Recall from the previous article that things in Azure SQL DB are different for Extended Events. XE is database scoped rather than server scoped (as is the case with your on-premises servers). Due to this change, finding the GUI for XE is a little different.

In order to find the GUI for XE, you must drill down into the database and then you will see “Extended Events.” (Side note, there is no XE Profiler for Azure SQL DB as of this writing.) If you right-click Sessions, you will get a menu with the option to create a New Session.

After clicking “New Session…” the familiar window for a new session will appear.

The post Azure DB – A Quick Spelunk Into XEvents to Love appeared first on SQL XEvents.

]]>
https://sqlxevents.com/azure-db-a-quick-spelunk-into-xevents-to-love/feed/ 0 1660
Memory – How to Find when Excess is a Bad Thing https://sqlxevents.com/memory-how-to-find-when-excess-is-a-bad-thing/?utm_source=rss&utm_medium=rss&utm_campaign=memory-how-to-find-when-excess-is-a-bad-thing https://sqlxevents.com/memory-how-to-find-when-excess-is-a-bad-thing/#respond Sat, 01 Jan 2022 00:03:31 +0000 https://sqlxevents.com/?p=1643 Excessive memory grants are extremely problematic in SQL Server. These excessive grants do not just happen out of the blue.

The post Memory – How to Find when Excess is a Bad Thing appeared first on SQL XEvents.

]]>
Excessive memory grants are extremely problematic in SQL Server. These excessive grants do not just happen out of the blue. Memory grants are directly linked to the queries. When you write a bad query and you can kill your server. One of the reasons bad queries kill servers is because they try to steal all of the memory. This article will help find these hog queries so they can be tuned.

There is a lot of science and art that is mixed together to help performance tune. Performance tuning is rather enjoyable because the rewards are usually very satisfying. There is nothing like the feeling of making a query go turbo speed.

When I say turbo speed, there is a bit of a tongue in cheek there. However, there is some truth to it. The causes of slow performance vary from query to query but the results of tuning usually all result in significantly faster query performance.

One such example of this happened when I encountered a query with a 118GB memory grant. I had to double check that figure multiple times just to make sure. Clearly there was a complaint that the query was way too slow. Sadly, the client only recognized the pain of the query when trying to migrate to AWS. Prior to the migration, they had oversized bare metal servers with top-shelf hardware that could conceal the worst of performance issues.

Memory – You’ll understand what happiness is

Digging into this particular query, I found a great deal of wrong with how it was written. I won’t digress into all of the bad anti-patterns, suffice it say there were plenty. These anti-patterns helped contribute to the 118GB memory grant. When tuning was sufficient and the query was within acceptable performance timings, the memory grant was

The post Memory – How to Find when Excess is a Bad Thing appeared first on SQL XEvents.

]]>
https://sqlxevents.com/memory-how-to-find-when-excess-is-a-bad-thing/feed/ 0 1643
Owner is Missing in the GUI – An Easy Fix https://sqlxevents.com/owner-is-missing-in-the-gui-an-easy-fix/?utm_source=rss&utm_medium=rss&utm_campaign=owner-is-missing-in-the-gui-an-easy-fix https://sqlxevents.com/owner-is-missing-in-the-gui-an-easy-fix/#respond Fri, 31 Dec 2021 18:23:00 +0000 https://sqlxevents.com/?p=1686 In this article, I will share an oddity that happens when the database owner is seemingly missing.

The post Owner is Missing in the GUI – An Easy Fix appeared first on SQL XEvents.

]]>
Having a Database Owner is not something that most people think about until something breaks. Usually, people will just kind of ignore it because it is just so innocuous and uncommon for the owner to not be “present”. In this article, I will share an oddity that happens when the database owner is seemingly missing.

Usually, when a database owner is not properly configured, an error message will be thrown. I have run into an odd case where there is no error message and thus no obvious indicator that there is a problem.

In this oddball case, the owner showed as sa just about everywhere but in the GUI. Not only was it showing in the GUI, but many scripts also reported that the database owner was set. Despite all of this evidence, there was one spot in the GUI that disagreed with everything. Let’s dive in and check things out!

Owners in the GUI

Let’s start with the the problem screen in the GUI. Typically, when an owner is missing or invalid, the properties screens won’t open. In this case, the properties windows do open but you end up with odd results.

Now that we can see that the owner is a bit jacked up somewhere, we can look at a quick query.

As you can see from both of those screen shots, I have the same problem in those areas. If I look at other spots though, I get different results.

A Different Owner

Having consistency in your applications is pretty important. When I run into something that shows different results, I find it a tad annoying. In the following images, you will see that inconsistency compared to the previous images.

And in the following script results, I get the same inconsistency…

The post Owner is Missing in the GUI – An Easy Fix appeared first on SQL XEvents.

]]>
https://sqlxevents.com/owner-is-missing-in-the-gui-an-easy-fix/feed/ 0 1686
Statistics Auditing to make you Omniscient https://sqlxevents.com/statistics-auditing-to-make-you-omniscient/?utm_source=rss&utm_medium=rss&utm_campaign=statistics-auditing-to-make-you-omniscient https://sqlxevents.com/statistics-auditing-to-make-you-omniscient/#respond Wed, 29 Dec 2021 17:12:39 +0000 https://sqlxevents.com/?p=1603 Statistics in SQL Server, love them or hate them, are essential to good performance. Statistics help to drive execution plan selection and thus can have quite a profound impact. If you have bad stats, you can end up with a very poor plan. Conversely, good stats can help the optimizer in selecting an optimal and…

The post Statistics Auditing to make you Omniscient appeared first on SQL XEvents.

]]>
Statistics in SQL Server, love them or hate them, are essential to good performance. Statistics help to drive execution plan selection and thus can have quite a profound impact. If you have bad stats, you can end up with a very poor plan. Conversely, good stats can help the optimizer in selecting an optimal and high performing plan.

Something that was recently requested of me was a means to help audit these statistics in SQL Server. Why? Well, as it turns out, it could prove very useful in determining who, why, and when statistics might have been changed.

One would think there should be no need to audit the statistics in SQL Server. Alas, you would be gravely wrong. I have seen so many weird things that it makes absolute sense to audit changes. You may be surprised to learn that there is a DBA on staff that is adding, dropping, changing, or updating stats out of cycle without communicating the changes.

How do we go about auditing these changes? Easy Peezee! We need only to employ the use and power of Extended Events (XEvents).

For the sake of posterity, I am also adding this to the MASSIVE collection of Extended Events articles.

XEvents to Audit your Statistics

Here comes the tricky part. Auditing your statistics is not quite as easy as auditing other traditional objects (like tables or indexes). Wait, I just mentioned indexes and stats are tightly coupled to indexes, right? True! Indexes and stats are very tightly coupled. So much so, that stats and indexes use the same identity increment for their id.

The post Statistics Auditing to make you Omniscient appeared first on SQL XEvents.

]]>
https://sqlxevents.com/statistics-auditing-to-make-you-omniscient/feed/ 0 1603
Powerful Monitoring for Your Linked Servers with XEvents https://sqlxevents.com/powerful-monitoring-for-your-linked-servers-with-xevents/?utm_source=rss&utm_medium=rss&utm_campaign=powerful-monitoring-for-your-linked-servers-with-xevents https://sqlxevents.com/powerful-monitoring-for-your-linked-servers-with-xevents/#respond Thu, 02 Sep 2021 22:15:00 +0000 https://sqlxevents.com/?p=1552 Linked servers are the bane of good performance and are wrought with all sorts of “hidden” problems.

The post Powerful Monitoring for Your Linked Servers with XEvents appeared first on SQL XEvents.

]]>
When I am looking for random failures or looking to resolve performance issues, one of the first things I like to check is if there are any linked servers that could be contributing to the problem. Linked servers are the bane of good performance and are wrought with all sorts of “hidden” problems such as those outlined in this article – here.

Granted there are times when a linked server makes a lot of sense. When choosing to use a linked server, it must be understood what the purpose of the linked server will be and to not abuse the linked server. Restrict the use of the linked server to a small scope and hopefully an infrequent use. For instance, I have demonstrated good uses of linked servers in my poor mans audit presentation and in my database restore solutions article.

Do you know if you have linked servers? Now is a good time to check. Furthermore, if you do have linked servers do you know the extent of use on these linked servers? It is a quick and painless check to determine if linked servers have invaded your environment.

Linked Server Invasion?

If you need to check for the existence of linked servers in your environment, this quick tutorial can catch you up to speed and help with that task. As a short-cut here is a query that can help as well.

The post Powerful Monitoring for Your Linked Servers with XEvents appeared first on SQL XEvents.

]]>
https://sqlxevents.com/powerful-monitoring-for-your-linked-servers-with-xevents/feed/ 0 1552
3 Highly Improved Help Queries for XEvents in Azure SQL https://sqlxevents.com/3-highly-improved-help-queries-for-xevents-in-azure-sql/?utm_source=rss&utm_medium=rss&utm_campaign=3-highly-improved-help-queries-for-xevents-in-azure-sql https://sqlxevents.com/3-highly-improved-help-queries-for-xevents-in-azure-sql/#respond Mon, 05 Jul 2021 17:47:00 +0000 https://sqlxevents.com/?p=1583 Finding the right event or combination of events to monitor may seem like quite a daunting task with so many events to explore and (frequently) too little familiarity with Extended Events.

The post 3 Highly Improved Help Queries for XEvents in Azure SQL appeared first on SQL XEvents.

]]>
Finding the right event or combination of events to monitor may seem like quite a daunting task with so many events to explore and (frequently) too little familiarity with Extended Events. In this follow-up article to Extended Events Help Queries, I will share another means to quickly explore the Extended Events metadata for Azure SQL in the effort to find the precise event to fit your needs.

In this article, I will be sharing a new query or two that I have used on more than one occasion to help track down the event(s) that I wanted to, at least, try while troubleshooting specific problems within the SQL Server Instance. I found these queries useful once again in a recent opportunity to help out some friends from the SQL Community. (Maybe, just maybe, these are really just a spin of other previously shared queries.) I will share the most recent experience in another follow-up post.

For the sake of posterity, I am also adding this to the MASSIVE collection of Extended Events articles.

Is There an Event that Contains pertinent Data?

In my previous article, I demonstrated how to find an event based solely on the name or description of the event. This is fantastic if the event name (or description) contains one of the magical words you have used. What if the event name or description has nothing to do with the terms you selected? Or, what if the data you seek may be attached to the event but wouldn’t necessarily stand out as a description for that event (by name or description details for that event)?

Now comes the more difficult task right? If the name or description of the event doesn’t relate to the search terms then you just might overlook a few events and be stuck…

The post 3 Highly Improved Help Queries for XEvents in Azure SQL appeared first on SQL XEvents.

]]>
https://sqlxevents.com/3-highly-improved-help-queries-for-xevents-in-azure-sql/feed/ 0 1583
Top 3 Easy Help Queries for XEvents in Azure SQL https://sqlxevents.com/top-3-easy-help-queries-for-xevents-in-azure-sql/?utm_source=rss&utm_medium=rss&utm_campaign=top-3-easy-help-queries-for-xevents-in-azure-sql https://sqlxevents.com/top-3-easy-help-queries-for-xevents-in-azure-sql/#respond Sun, 04 Jul 2021 18:29:00 +0000 https://sqlxevents.com/?p=1571 I would like to share a few quick scripts to help find some of the event information for SQL Azure when attempting to use XEvents. In the long run, these little helper queries will help make your life easier.

The post Top 3 Easy Help Queries for XEvents in Azure SQL appeared first on SQL XEvents.

]]>
When working with Extended Events (XEvents), there are times when a little more information is, well, helpful.  You know you want to use XEvents to try and monitor for a specific thing to happen.  But, sometimes, you don’t know if there is an event for that “thing”, or maybe you don’t know if there is a session already in place to do that specific task (or if it is even running). Or, maybe, you just need better information about the event to see what kind of payload is captured/delivered when it is fired.

Sometimes, this information is easy enough to find.  Sometimes, it is less than evident how to find the wanted information.  Some of the information may be visible through the GUI (if you are using SQL Server Management Studio 2012 or later), and sometimes it is just flat out easier to run a quick script.  Today, I would like to share a few quick scripts to help find some of the event information for SQL Azure when attempting to use XEvents. In the long run, these little helper queries will help make your life easier.

Does an Event Exist?

First let’s tackle the problem of discovery.  When we want to use XEvents to try and troubleshoot a problem (or to capture more information) in SQL Azure, it is really good to know if a relevant event exists.  There are many events that capture data for various different things within SQL Server. There are far fewer events available in SQL Azure (that is the subject of a different article).

That said, more events are being added on a regular basis.  More and more data is being made available to the DBA to help perform a better job and to help the DBA better understand what is really happening…

The post Top 3 Easy Help Queries for XEvents in Azure SQL appeared first on SQL XEvents.

]]>
https://sqlxevents.com/top-3-easy-help-queries-for-xevents-in-azure-sql/feed/ 0 1571
Extended Events Categories: An Introduction https://sqlxevents.com/extended-events-categories-an-introduction/?utm_source=rss&utm_medium=rss&utm_campaign=extended-events-categories-an-introduction https://sqlxevents.com/extended-events-categories-an-introduction/#respond Fri, 22 May 2020 12:42:00 +0000 https://sqlxevents.com/?p=719 Packages come with a pair of descriptors (or classifiers) that will be useful in correlating related events contained within a given package.

The post Extended Events Categories: An Introduction appeared first on SQL XEvents.

]]>
Previously, I gave a brief explanation of the concept of “Packages” as it relates to Extended Events (XEvents). In that article, I taught you some basic concepts about packages. However, I did not go deep into some of the granular details such as Extended Events categories.

Packages come with a pair of descriptors (or Extended Events categories). Importantly, you use descriptors to find related events in the package. Therefore, you will find using these descriptors helpful in creating an XEvent session to troubleshoot your specific issue.

XEvents packages have two basic types of categories. In other words, these classifiers are called keywords and channels.

XEvent Channels

An XEvents channel is defined just the same as a radio station or TV channel. Similarly, the XEvents channel indicates a stream of interest. In addition, it identifies the target audience for the event.

Term Definition
Admin These events are targeted to administrators and support. Firstly, these events indicate a problem with a solution that an administrator can act on. In addition, these events include a message indicating how to resolve the problem.
Operational Events that are used for analyzing and diagnosing a problem. For instance, one may use these to trigger tasks based on the occurrence. As a result, these events are for Administrators.
Analytic Use these in performance investigations. However, take note that these are a high volume type of events. Consequently, these events are ideal for anybody working on performance issues.
Debug Debug events are used solely by developers to diagnose a problem for debugging. As a result, you will use these primarily when working with CSS.

Different issues require different channels. As a result, your interest in a Channel will change day by day.

The post Extended Events Categories: An Introduction appeared first on SQL XEvents.

]]>
https://sqlxevents.com/extended-events-categories-an-introduction/feed/ 0 719