Skip to content

Commit 9656cb2

Browse files
Merge pull request #7052 from MicrosoftDocs/main
Auto Publish – main to live - 2025-08-21 17:00 UTC
2 parents 307785a + d7a498d commit 9656cb2

File tree

5 files changed

+403
-18
lines changed

5 files changed

+403
-18
lines changed

data-explorer/kusto/query/graph-best-practices.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.date: 05/29/2025
1111

1212
>[!INCLUDE [applies](../includes/applies-to-version/applies.md)] [!INCLUDE [fabric](../includes/applies-to-version/fabric.md)] [!INCLUDE [azure-data-explorer](../includes/applies-to-version/azure-data-explorer.md)] [!INCLUDE [monitor](../includes/applies-to-version/monitor.md)] [!INCLUDE [sentinel](../includes/applies-to-version/sentinel.md)]
1313
14-
Graph semanitcs supports two primary approaches for working with graphs: transient graphs created in-memory for each query, and persistent graphs defined as graph models and snapshots within the database. This article provides best practices for both methods, enabling you to select the optimal approach and use KQL graph semantics efficiently.
14+
Graph semantics supports two primary approaches for working with graphs: transient graphs created in-memory for each query, and persistent graphs defined as graph models and snapshots within the database. This article provides best practices for both methods, enabling you to select the optimal approach and use KQL graph semantics efficiently.
1515

1616
This guidance covers:
1717

@@ -29,7 +29,7 @@ There are two approaches for working with graphs: transient and persistent.
2929

3030
### Transient graphs
3131

32-
Created dynamically using the [`make-graph`](make-graph-operator.md) operator. These graphs exist only during query execution and are optimal for ad hoc or exploratory analysis on small to medium datasets.
32+
Created dynamically using the [`make-graph`](make-graph-operator.md) operator. These graphs exist only during query execution and are optimal for ad-hoc or exploratory analysis on small to medium datasets.
3333

3434
### Persistent graphs
3535

@@ -124,7 +124,7 @@ Use the [arg_max aggregation](arg-max-aggregation-function.md) function to deter
124124

125125
**Step 3: Create helper functions**
126126

127-
Ensure only the materialized component is used and apply additional filters:
127+
Ensure only the materialized component is used and apply another filters:
128128

129129
```kusto
130130
.create function currentEmployees () {
@@ -246,7 +246,7 @@ let assetHierarchy = datatable(source:string, destination:string)
246246
];
247247
```
248248

249-
The employees, sensors, and other entities and relationships do not share a canonical data model. The [union operator](union-operator.md) can be used to combine and standardize the data.
249+
The employees, sensors, and other entities and relationships don't share a canonical data model. The [union operator](union-operator.md) can be used to combine and standardize the data.
250250

251251
The following query joins the sensor data with the time series data to identify sensors with abnormal readings, then uses a projection to create a common model for the graph nodes.
252252

@@ -310,15 +310,15 @@ The projection in `graph-match` shows that the temperature sensor exhibited an a
310310

311311
## Best practices for persistent graphs
312312

313-
Persistent graphs, defined using [graph models](../management/graph/graph-model-overview.md) and [graph snapshots](../management/graph/graph-snapshot-overview.md), provide robust solutions for advanced graph analytics needs. These graphs excel in scenarios requiring repeated analysis of large, complex, or evolving data relationships, and facilitate collaboration by enabling teams to share standardized graph definitions and consistent analytical results. By persisting graph structures in the database, this approach significantly enhances performance for recurring queries and supports sophisticated versioning capabilities.
313+
Persistent graphs, defined using [graph models](../management/graph/graph-model-overview.md), and [graph snapshots](../management/graph/graph-snapshot-overview.md), provide robust solutions for advanced graph analytics needs. These graphs excel in scenarios requiring repeated analysis of large, complex, or evolving data relationships, and facilitate collaboration by enabling teams to share standardized graph definitions and consistent analytical results. By persisting graph structures in the database, this approach significantly enhances performance for recurring queries and supports sophisticated versioning capabilities.
314314

315315
### Use schema and definition for consistency and performance
316316

317317
A clear schema for your graph model is essential, as it specifies node and edge types along with their properties. This approach ensures data consistency and enables efficient querying. Utilize the `Definition` section to specify how nodes and edges are constructed from your tabular data through `AddNodes` and `AddEdges` steps.
318318

319-
### Leverage static and dynamic labels for flexible modeling
319+
### Use static and dynamic labels for flexible modeling
320320

321-
When modeling your graph, you can utilize both static and dynamic labeling approaches for optimal flexibility. Static labels are ideal for well-defined node and edge types that rarely change—define these in the `Schema` section and reference them in the `Labels` array of your steps. For cases where node or edge types are determined by data values (for example, when the type is stored in a column), use dynamic labels by specifying a `LabelsColumn` in your step to assign labels at runtime. This approach is especially useful for graphs with heterogeneous or evolving schemas. Both mechanisms can be effectively combined—you can define a `Labels` array for static labels and also specify a `LabelsColumn` to incorporate additional labels from your data, providing maximum flexibility when modeling complex graphs with both fixed and data-driven categorization.
321+
When modeling your graph, you can utilize both static and dynamic labeling approaches for optimal flexibility. Static labels are ideal for well-defined node and edge types that rarely change—define these in the `Schema` section and reference them in the `Labels` array of your steps. For cases where node or edge types are determined by data values (for example, when the type is stored in a column), use dynamic labels by specifying a `LabelsColumn` in your step to assign labels at runtime. This approach is especially useful for graphs with heterogeneous or evolving schemas. Both mechanisms can be effectively combined—you can define a `Labels` array for static labels and also specify a `LabelsColumn` to incorporate labels from your data, providing maximum flexibility when modeling complex graphs with both fixed and data-driven categorization.
322322

323323
#### Example: Using dynamic labels for multiple node and edge types
324324

@@ -376,7 +376,7 @@ Large-scale multitenant environments often exhibit the following characteristics
376376

377377
### Partitioning by natural boundaries
378378

379-
The most effective approach for managing large-scale graphs is partitioning by natural boundaries, typically tenant identifiers or organizational units:
379+
The most effective approach for managing large-scale graphs is partitioning by natural boundaries, typically tenant identifiers, or organizational units:
380380

381381
**Key partitioning strategies:**
382382

@@ -413,14 +413,14 @@ The most cost-effective strategy combines both transient and persistent graphs b
413413

414414
#### Small to medium tenants (99.9% of tenants)
415415

416-
Use **transient graphs** for the majority of tenants:
416+
Use **transient graphs** for most tenants:
417417

418418
**Advantages:**
419419

420420
- **Always up-to-date data** - No snapshot maintenance required
421421
- **Lower operational overhead** - No graph model or snapshot management
422-
- **Cost-effective** - No additional storage costs for graph structures
423-
- **Immediate availability** - No pre-processing delays
422+
- **Cost-effective** - No extra storage costs for graph structures
423+
- **Immediate availability** - No preprocessing delays
424424

425425
**Implementation pattern:**
426426

@@ -518,22 +518,29 @@ graph("ContosoOrgChart")
518518
5. **Resource management** - Use workload groups to prevent large tenant queries from affecting smaller tenants
519519
6. **Cost optimization** - Regularly review and optimize the persistent/transient threshold based on actual usage patterns
520520

521-
This hybrid approach enables organizations to provide always-current data analysis for the majority of tenants while delivering enterprise-scale analytics capabilities for the largest tenants, optimizing both cost and performance across the entire customer base.
521+
This hybrid approach enables organizations to provide always-current data analysis for most tenants while delivering enterprise-scale analytics capabilities for the largest tenants, optimizing both cost and performance across the entire customer base.
522522

523523
:::moniker-end
524524

525525
## Related content
526526

527527
:::moniker range="microsoft-fabric || azure-data-explorer"
528+
528529
- [Graph semantics overview](graph-semantics-overview.md)
529530
- [Common scenarios for using graph semantics](graph-scenarios.md)
531+
- [Graph sample datasets and examples](graph-sample-data.md)
532+
- [Graph exploration basics](graph-exploration-basics.md)
530533
- [Graph function](graph-function.md)
531534
- [make-graph operator](make-graph-operator.md)
532535
- [Graph models overview](../management/graph/graph-model-overview.md)
536+
533537
:::moniker-end
534538

535539
:::moniker range="azure-monitor || microsoft-sentinel"
540+
536541
- [Graph semantics overview](graph-semantics-overview.md)
537542
- [Common scenarios for using graph semantics](graph-scenarios.md)
543+
- [Graph sample datasets and examples](graph-sample-data.md)
538544
- [make-graph operator](make-graph-operator.md)
545+
539546
:::moniker-end

0 commit comments

Comments
 (0)