Partitions in Tabular Models

This document explains how to use partitions to divide tables into smaller, manageable pieces for improved performance and manageability in SQL Server Analysis Services (SSAS) tabular models.

What are Partitions?

In a tabular model, partitions are used to divide a table into smaller logical and physical parts. This division is primarily for data management and performance optimization. Each partition stores a subset of a table's data. By managing data in smaller chunks, you can:

Creating and Managing Partitions

Partitions are managed using tools like SQL Server Management Studio (SSMS) or Visual Studio with the Analysis Services projects extension.

Using SQL Server Management Studio (SSMS)

  1. Connect to your Analysis Services instance in SSMS.
  2. Navigate to the tabular database containing your model.
  3. Right-click on the table for which you want to create partitions and select Partitions.
  4. In the Partitions Manager dialog, you can:
    • Create New Partition: Define the source query for the new partition.
    • Edit Partition: Modify the source query, name, or properties of an existing partition.
    • Delete Partition: Remove a partition.
    • Duplicate Partition: Create a new partition based on an existing one.
  5. You can define partitions based on date ranges, specific criteria, or data segments.

Using Visual Studio

When developing a tabular model in Visual Studio:

  1. Open your tabular model project.
  2. In the Model Explorer, right-click on the table.
  3. Select Partitions.
  4. The Partitions Manager will open, similar to the SSMS experience, allowing you to create, edit, and manage partitions for your tables.

Partitioning Strategies

Effective partitioning requires a well-thought-out strategy. Common strategies include:

Best Practices for Partitions

Tip: For tabular models in Azure Analysis Services or SQL Server Analysis Services 2017 and later, partitions can significantly boost performance for large datasets.

Example: Date-Based Partitioning Query

Here's a conceptual example of how you might define a partition for sales data from 2023:

SELECT * FROM Sales WHERE OrderDate >= '2023-01-01' AND OrderDate < '2024-01-01'

You would then create separate partitions for other years or time periods using similar queries.