Choosing Storage Mode

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 9 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Lesson: Choosing Storage Modes in Semantic Models

Introduction: The Foundation of Performance and Scalability

In the world of data modeling and business intelligence, the semantic model serves as the bridge between raw data sources and the end-user experience. When you design a semantic model, you are essentially defining the structure, relationships, and business logic that power your reports and dashboards. However, even the most elegant model will fail if it cannot deliver data to the user at the speed of thought. One of the most critical architectural decisions you will make is choosing the appropriate storage mode for your data.

Storage modes determine where your data physically resides and how it is retrieved when a user interacts with a report. Whether you are using tools like Power BI, Analysis Services, or similar tabular modeling engines, the storage mode dictates the trade-off between query performance, data freshness, and system resources. Choosing the wrong mode can lead to sluggish report performance, excessive load on your source databases, or unnecessarily high infrastructure costs.

This lesson explores the three primary storage modes: Import, DirectQuery, and Composite models. We will examine how they work under the hood, when to use each, and how to combine them effectively to build high-performing, scalable analytical solutions. Understanding these concepts is not just a technical requirement; it is a fundamental skill for any data architect aiming to provide a reliable and efficient data platform for their organization.


Not read yet

Understanding the Three Storage Modes

Before we dive into the implementation details, we need to define the three pillars of storage architecture in modern semantic modeling. Each mode addresses a specific set of requirements regarding latency, data volume, and connectivity.

1. Import Mode

Import mode is the default and most common storage method for semantic models. When you choose Import, the engine pulls the data from your source systems, compresses it, and stores it in the memory (RAM) of the server or the cloud service. Because the data is physically loaded into the engine’s memory, query responses are incredibly fast. The engine can perform complex calculations and aggregations across millions of rows in milliseconds because it is not waiting for a round-trip to an external database.

2. DirectQuery Mode

DirectQuery mode operates on the opposite philosophy. Instead of loading data into the engine, the semantic model acts as a pass-through layer. When a user interacts with a report, the engine generates an optimized query (usually in SQL) and sends it directly to the source database. The source database processes the query and sends the results back to the reporting tool. This mode is essential when you have massive datasets that cannot fit into memory or when your business requirements dictate that users must see data with zero latency (real-time).

3. Composite (Dual) Mode

Composite models are the modern standard for complex enterprise environments. They allow you to mix and match Import and DirectQuery tables within a single model. You might import smaller, dimension-style tables (like Date or Product hierarchies) into memory for speed, while keeping massive fact tables in DirectQuery mode to query against the source system. This "best of both worlds" approach allows architects to balance performance and scale without compromising on data freshness.

Callout: Memory vs. Query Latency The core tension in semantic modeling is between memory capacity and query latency. Import mode consumes memory but provides near-instant query speed. DirectQuery consumes no memory for the data itself but introduces latency because every user click triggers a database query. Understanding this trade-off is the primary factor in designing a stable model.


Not read yet

Deep Dive: Import Mode

Import mode is generally the preferred choice for most business scenarios because of its superior performance. When data is imported, it is stored in a highly compressed columnar format. This format is optimized for aggregation, which is why your measures—like SUM, AVERAGE, or COUNT—perform so efficiently.

When to Choose Import Mode

  • Performance is the priority: If your users expect sub-second response times, Import is almost always the answer.
  • Data volume is manageable: If your dataset fits within the memory limits of your chosen license or hardware, there is rarely a reason to look elsewhere.
  • Data transformation is complex: Import mode allows you to use the full power of your data transformation engine (like Power Query) to clean, merge, and reshape data before it is stored.
  • Offline access: Since the data is in the model, the report can still function even if the source database is temporarily unavailable or undergoing maintenance.

Managing Import Mode Constraints

The biggest challenge with Import mode is the refresh cycle. Because the data is a snapshot, you must schedule refreshes to keep it current. If your business needs updates every five minutes, Import mode might become a burden on your source systems, as frequent large-scale data extractions can create significant server load.

Tip: Optimize Your Data Even in Import mode, you should follow "star schema" best practices. Avoid wide, flat tables (denormalized "monster" tables). By splitting your data into fact and dimension tables, you allow the engine to compress the data more efficiently, which reduces the overall memory footprint.


Not read yet

Deep Dive: DirectQuery Mode

DirectQuery is the "go-to" for large-scale data scenarios where the source database is designed to handle heavy analytical workloads. When using DirectQuery, the semantic model acts as a semantic layer—it translates DAX queries into the native query language of the source (e.g., T-SQL for SQL Server, or specialized languages for cloud data warehouses like Snowflake or BigQuery).

When to Choose DirectQuery Mode

  • Massive Datasets: When your data size exceeds the memory limits of your platform, DirectQuery is the only option.
  • Real-time Requirements: If the user must see the transaction that happened five seconds ago, DirectQuery allows for near-real-time visibility.
  • Security Policies: Some organizations have strict row-level security (RLS) requirements where data must never be cached outside the source database. DirectQuery ensures the data stays in the source environment.
  • Source Performance: If your source database is a modern, high-performance analytical engine (like a column-store database), it may be fast enough that the overhead of DirectQuery is negligible.

Common Pitfalls of DirectQuery

The primary risk with DirectQuery is the "noisy neighbor" effect. Because every interaction in the report triggers a database query, a poorly designed report—or a user applying too many filters—can send an overwhelming number of queries to your production database. This can slow down the very source systems your business relies on for daily operations.

Warning: Avoid Calculated Columns in DirectQuery In DirectQuery mode, avoid creating calculated columns in your semantic model if possible. These calculations are performed during the query execution process, which can drastically increase the complexity and execution time of the SQL generated for the source database. Always try to perform these calculations in the source database (via views or stored procedures) before the data reaches the semantic model.


Not read yet

Implementing Composite Models

Composite models represent the maturation of semantic modeling. Instead of choosing between Import or DirectQuery, you can configure individual tables to use different modes. This is often referred to as a "Dual" storage mode.

The Power of Dual Mode

A table in "Dual" mode acts as both Import and DirectQuery. If you have a Date table, you can set it to Dual mode. When this table is used in a report with other Import tables, the engine uses the cached memory version. If it is used in a report with DirectQuery tables, the engine automatically switches to using the DirectQuery version, preventing the need to pull data from the cache and join it across different storage types.

Step-by-Step Implementation Strategy

  1. Identify your dimensions: These are typically smaller tables, like Customers, Products, or Calendars. Import these into your model to take advantage of the speed.
  2. Identify your facts: These are the large transaction tables. Keep these in DirectQuery mode if they are too large for memory.
  3. Configure Relationships: Ensure that your relationships are correctly defined. In a composite model, you must be careful with "cross-source" joins. If you join an Import table to a DirectQuery table, the engine may need to pull data from the DirectQuery source into memory to complete the join, which can negate the performance benefits of DirectQuery.
  4. Test Query Performance: Use tools like Performance Analyzer to monitor how long queries take. If you see high latency, examine the generated SQL to ensure the engine is pushing filters down to the source database.
Feature Import Mode DirectQuery Mode Composite/Dual Mode
Performance Excellent (In-memory) Varies (Source dependent) Balanced
Data Freshness Scheduled Refresh Real-time Mixed
Data Size Limited by Memory Unlimited Scalable
Complexity Simple High Very High
Source Load Low (Periodic) High (Per Query) Balanced

Not read yet

Practical Examples and Code Snippets

Example 1: Defining a DirectQuery Connection

When connecting to a SQL Server database, you select the "DirectQuery" radio button in the connection dialog. However, you can also define this programmatically or via Tabular Editor.

-- This is an example of what the semantic engine generates
-- when a user filters by 'Category' in a DirectQuery report.
SELECT 
    [ProductCategory], 
    SUM([SalesAmount]) as TotalSales
FROM [Sales].[FactSales]
GROUP BY [ProductCategory]

Explanation: The engine takes the user's interaction (selecting a category) and translates it into this SQL. The efficiency of your model now depends entirely on the indexing of the FactSales table in your SQL Server. If there is no index on ProductCategory, the query will be slow, regardless of how well you designed your semantic model.

Example 2: Using Dual Mode for a Date Dimension

If you are building a large model, your Date table is used in almost every report. By setting it to "Dual," you ensure that the engine can join the Date table to both your Import and DirectQuery tables efficiently.

Step-by-step instruction:

  1. Go to the Model view in your modeling software.
  2. Select the DimDate table.
  3. In the Properties pane, look for "Advanced" settings.
  4. Change the "Storage mode" to "Dual."
  5. Repeat this for all small dimension tables that are used in conjunction with DirectQuery fact tables.

Not read yet

Best Practices and Industry Standards

To ensure your semantic model remains maintainable and fast, follow these industry-standard practices.

1. The "Star Schema" Rule

Regardless of the storage mode, always organize your data into a star schema. This involves a central fact table surrounded by dimension tables. This structure is the most efficient for analytical engines to navigate, whether they are processing data in memory or generating SQL for a remote source.

2. Minimize Data Volume Early

Do not import data you do not need. Use Power Query to filter out irrelevant rows and remove unnecessary columns before they ever reach the model. Every column you remove reduces the memory footprint in Import mode and simplifies the SQL generated in DirectQuery mode.

3. Monitor "Query Folding"

Query folding is the process where Power Query attempts to push as much transformation logic as possible back to the source database. If you use DirectQuery, query folding is mandatory. If you see a warning in your transformation steps (often indicated by a "native query" warning), it means the engine cannot fold the logic, and it will have to process the data locally, which is a major performance killer.

4. Index Your Source Databases

When using DirectQuery, the semantic model is only as fast as the source database. Ensure your fact tables are properly indexed, particularly on the columns used in joins and filters (e.g., Date keys, Product keys). A well-indexed SQL table can make DirectQuery feel almost as fast as Import mode.

5. Use Aggregations

Aggregations are a powerful feature that allows you to store pre-calculated totals in Import mode while keeping the granular data in DirectQuery mode. When a user looks at a high-level report (e.g., "Total Sales by Year"), the engine hits the cached Import aggregation. When the user drills down to the transaction level, the engine automatically switches to DirectQuery.

Note: Aggregations require planning To use aggregations, you must define them explicitly. You need a hidden table in your model that contains the pre-aggregated data. The engine then manages the "switching" logic automatically, so the end-user does not even know the model is using two different storage modes.


Not read yet

Common Mistakes and How to Avoid Them

Mistake 1: Importing "Everything"

A common mistake is importing entire database tables, including columns that are never used in reports. This bloats the model, increases refresh times, and slows down the engine.

  • Fix: Use a "Select" statement in your source connection to pull only the required columns, or remove unnecessary columns in the transformation layer.

Mistake 2: Mixing Storage Modes without "Dual"

If you have an Import fact table and a DirectQuery fact table, and you try to relate them to the same dimension, you will run into "Limited Relationships." These relationships are slower and can lead to unexpected results.

  • Fix: Always ensure that common dimensions are set to "Dual" mode when working in complex, mixed-mode environments.

Mistake 3: Neglecting Security in DirectQuery

Developers often assume that because they have configured security in the semantic model, it is automatically applied to the source. In DirectQuery, the source database must also be configured to respect the user's security context.

  • Fix: Use "Single Sign-On" (SSO) or "Delegated Identity" when connecting to your data sources. This ensures the source database sees the user as the actual person running the report, allowing it to apply its own security policies.

Mistake 4: Over-complicating DAX

Complex DAX measures (like heavy use of FILTER functions or ALLSELECTED) can cause the engine to generate inefficient SQL in DirectQuery mode.

  • Fix: Simplify your DAX. If a measure is too complex for the engine to translate, the engine may be forced to pull all the data into memory to perform the calculation locally, which defeats the purpose of using DirectQuery.

Not read yet

Summary of Key Takeaways

  1. Storage Mode is Architectural: Choosing between Import, DirectQuery, and Composite modes is a fundamental decision that dictates the performance, scalability, and maintenance requirements of your analytical solution.
  2. Import is the Default: Always start with Import mode unless you have a specific technical constraint (data size or real-time requirements) that forces you to use DirectQuery. Import mode provides the best user experience.
  3. DirectQuery for Scale: Use DirectQuery when your data exceeds your memory capacity or when the business requirement for real-time data outweighs the need for high-speed performance.
  4. Composite Models Offer Flexibility: By using Composite models with Dual-mode dimensions, you can gain the best of both worlds—high-speed performance for common dimensions and massive scalability for fact tables.
  5. Query Folding is Critical: In DirectQuery, ensure your transformations and DAX measures fold back to the source database. If they don't, your performance will suffer significantly.
  6. Maintain Your Source: DirectQuery performance is directly tied to the health and indexing of your source database. You cannot have a high-performing semantic model if your underlying database tables are not optimized.
  7. Aggregations are the Bridge: Use aggregations as a standard practice for large datasets to provide a fast, responsive user experience while maintaining the ability to drill into granular, real-time data when needed.

By mastering these storage modes, you move beyond simply "building reports" to becoming a true data architect. You will be able to design systems that handle millions of rows with ease, satisfy real-time reporting needs, and keep your infrastructure costs under control. Remember, the best semantic model is the one that is invisible to the user—it just works, and it works fast.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.