A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/sql/docs/sqlserver/extended-events below:

Analyze database performance with Extended Events | Cloud SQL Documentation

Analyze database performance with Extended Events

Stay organized with collections Save and categorize content based on your preferences.

This page describes how to use Extended Events (XEvents) on your instances.

Cloud SQL supports using XEvents for monitoring, identifying, and troubleshooting the performance of your database. To do this, you create XEvent sessions and read XEvent output files. You can read the XEvent output files either on the instance or by downloading the XEvent files from a Cloud Storage bucket.

Before you begin

If you want to upload your XEvent files to a Cloud Storage bucket, then create a bucket in your Google Cloud account.

Note: You need to manage log retention in the Cloud Storage bucket. For information about adding a retention policy to specify a retention period, see Retention policies and retention policy locks. Best practices How to create XEvent sessions

XEvents is enabled on your instances automatically.

Use the CREATE EVENT SESSION command to define new XEvent sessions. You also can use the user interface of SQL Server Management Studio (SSMS) to create XEvent sessions.

Cloud SQL enforces the following parameters for all XEvent sessions:

Parameter Description Allowed values FILENAME Specifies the filename and path for storing XEvents Session data. Any path that starts with /var/opt/mssql/xevents/ MAX_FILE_SIZE Specifies the maximum size of each output file before a new file is created. A minimum of 10 MB
A maximum of 1 GB MAX_MEMORY Specifies the maximum amount of memory to allocate to the session for event buffering. A minimum of 4 MB
A maximum of 8 MB MAX_DISPATCH_LATENCY Specifies the maximum time (in seconds) that events can remain in the event dispatch queue before being sent to the target. A minimum of 1 sec
A maximum of 30 sec MAX_EVENT_SIZE Sets the maximum size of each event, in bytes. A minimum of 4 MB
A maximum of 8 MB XEvent session configuration parameters

You can configure XEvent sessions by using the following parameters as custom flags:

Parameter Description cloud sql xe bucket name Specify the Cloud Storage bucket to which you want to upload the XEvent session output. If this isn't specified, then Cloud SQL doesn't upload the XEvent session output data to Cloud Storage. cloud sql xe output total disk size (mb) Specify the amount of disk space to be reserved for the output of all XEvent sessions. If this isn't specified, then Cloud SQL uses a default disk space of 512 MB. If the XEvent output files use disk space more than the value of cloud sql xe output total disk size (mb), then Cloud SQL removes these files from the disk. cloud sql xe file retention (mins) Specify the retention time on the instance in minutes for files generated by the file targets of XEvent sessions. If this isn't specified, then Cloud SQL uses a default value of 7 days. cloud sql xe upload interval (mins) Specify the upload interval for XEvent files being uploaded to Cloud Storage. If this isn't specified, then Cloud SQL uses a default value of 10 minutes.

For more information about setting these flags, see Configure database flags.

How to read XEvent session output files

You can read XEvent session output files from either a Cloud SQL instance or a Cloud Storage bucket.

Read XEvent output files from an instance

To retrieve the data from an XEvent file that an XEvent session creates, use the sys.fn_xe_file_target_read_file function.

Here's an example:

SELECT * FROM sys.fn_xe_file_target_read_file('/var/opt/mssql/xevents/filename*, NULL, NULL, NULL);
Read XEvent output files from a bucket

To read XEvent output files from a Cloud Storage bucket, download the files from the bucket to a SQL Server instance. You can download from one of the following instances:

Then, transfer the XEvent output files from the bucket to a location accessible to that instance, such as its local disk. Next, to return information from the XEvent output file, run the sys.fn_xe_file_target_read_file function with an account that has the VIEW SERVER STATE permission on the server. For more information about permissions, see Permissions.

Monitoring metrics

You can monitor the following xevent-related operations as part of the Cloud SQL metrics, available through Metrics Explorer:

Monitor XEvent sessions

You can monitor XEvent session-related activities through the xevents.log file for the following operations:

Considerations for read replicas

This section contains information about XEvent sessions for new and existing read replicas.

For new read replicas For existing read replicas Note: If an XEvent session is created on a read replica, but the replica is recreated after the session is created, then the session no longer appears on the replica.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-14 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4