Azure Synapse Analytics

Unify data integration and enterprise data warehousing

Kusto Query Language (KQL) Overview

Kusto Query Language (KQL) is a powerful, highly efficient query language for Azure Data Explorer, Azure Monitor Logs, Azure Sentinel, and Azure Synapse Analytics. It's designed for exploring data and discovering patterns, identifying anomalies, and troubleshooting issues.

Key Concepts of KQL

KQL queries are read-only queries that describe the data to retrieve. The query is composed of a sequence of query operators, where each operator takes a table (or the output of the previous operator) as input and produces a table as output. This makes it easy to construct complex queries by composing simple operators.

Core Operators

Query Structure

A typical KQL query follows this structure:

TableName | operator1 arguments | operator2 arguments | ...

Example Query

Let's say you have a table named Logs with columns like Timestamp, Level, Message, and Source. To find the 10 most recent error messages:

Logs | where Level == "Error" | sort by Timestamp desc | take 10 | project Timestamp, Message, Source

Features and Capabilities

Time-Series Analysis

Built-in functions for time series analysis, including time bucketing and trend detection.

Rich Data Types

Supports complex data types like dynamic objects, arrays, and geographical data.

Performance

Optimized for high-volume, high-velocity data, enabling fast querying over terabytes of data.

Extensibility

Integrates with other Azure services and supports user-defined functions (UDFs).

Machine Learning Integration

Functions like mv-avg and diff for basic anomaly detection and forecasting.

Getting Started with KQL in Synapse

You can write and execute KQL queries directly within the Azure Synapse Studio for your Data Explorer pools. Explore your data, build dashboards, and create alerts.

Tip: Use the schema explorer in Synapse Studio to easily discover tables and columns, and to auto-complete your KQL queries.

Common Aggregation Functions

Advanced Features

For more in-depth information, refer to the official KQL documentation.