BI Connection Strategy and Filter Execution Order
System DesignModel answerLast updated
Choose connection modes, tune query performance, and understand filter precedence for dashboards over large datasets in business intelligence platforms.
You're building a business intelligence dashboard that queries a fact table with 100 million rows.
Part 1: Connection Architecture
Your BI platform offers two connection modes:
- Direct connection: queries hit the database on every user interaction
- In-memory cache: data is copied into the BI tool's engine and refreshed periodically
For the 100M-row scenario, compare these approaches across:
- Data freshness and staleness tolerance
- Query performance and predictability
- Infrastructure cost and load patterns
- Storage footprint in the BI tool
- Refresh strategies (full replacement vs adding only new records)
- Row-level security enforcement options
Provide a recommendation with reasoning.
Part 2: Filter Execution Precedence
The BI platform processes filters and calculations in a specific sequence. Explain how execution order affects dashboard results when you combine:
- Filters applied at the data source level
- Context-setting filters that create intermediate subsets
- Standard dimension and measure filters
- Top-N selections
- Level-of-detail calculations (aggregations at fixed, broader, or narrower grain than the visualization)
- Post-aggregation table calculations
Give concrete examples where filter order changes the output.
Part 3: Performance Optimization
Describe strategies to improve dashboard speed:
- When to promote filters to earlier execution stages
- How to reduce cache size and query scope
- Trade-offs between denormalized tables vs normalized joins
- How to identify whether bottlenecks are in query execution vs rendering
Part 4: Platform Migration
If migrating this dashboard to a different BI platform with similar but not identical architecture, what is one critical error to avoid?
Hints
Hint 1
Consider that earlier filter stages reduce data volume for all subsequent operations
Hint 2
Level-of-detail calculations computed at different stages interact differently with user-applied filters
Hint 3
Query pushdown to the database versus in-tool computation have fundamentally different cost and performance profiles
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer
Part 1: Connection Mode Comparison and Recommendation
Direct Connection Characteristics:
Data freshness is immediate—every visualization update queries the source database. Performance depends entirely on the warehouse: query latency, concurrent user load, and data model optimization all matter. Infrastructure costs scale with user activity since each dashboard interaction generates queries. No storage is consumed in the BI tool itself. Security can leverage database-native mechanisms: per-user credentials, dynamic SQL injection of user context, or warehouse-enforced row access policies.
In-Memory Cache Characteristics:
Data reflects the last refresh—hourly, daily, or on-demand. Query execution happens in the BI tool's optimized columnar engine, typically delivering sub-second response for aggregations with predictable latency. Infrastructure load concentrates at refresh time rather than being distributed across user sessions. Storage footprint for 100M rows with ~20 columns ranges from 2-8 GB compressed, reducible through aggressive filtering and aggregation. Refresh can be full (replace everything) or incremental (append new rows based on an increasing timestamp or ID). Row-level security must be implemented within the BI tool using filter logic tied to user identity.
Incremental Refresh Nuances:
Incremental refresh only appends rows beyond the last high-water mark. It doesn't capture updates to existing rows, deletions, or late-arriving data below the watermark. A robust pattern runs incremental refreshes frequently (hourly) with periodic full refreshes (nightly or weekly) to reconcile. Some implementations support a trailing lookback window that re-pulls recent data.
Recommendation for 100M Rows:
Use in-memory cache by default. With proper aggregation (rolling up to day-grain or key dimensions), the dataset often compresses to 1-5M rows. This delivers fast, predictable performance for high user concurrency while reducing warehouse cost-per-query. Apply cache filters to retain only relevant time windows (last 24 months) and drop unused columns.
Switch to direct connection only when: (a) true real-time data is required for operational monitoring, (b) governance mandates database-enforced security, (c) the warehouse has excellent performance with result caching already in place, or (d) data changes too frequently or is too large to copy effectively.
Part 2: Filter Execution Order and Impacts
The execution sequence from first to last:
- Cache-creation filters: exclude rows before they enter the in-memory engine
- Data source filters: apply universally to all visualizations using that source; ideal location for security entitlements
- Context filters: create a filtered intermediate dataset for subsequent steps
- Fixed-grain calculations: computed after context but ignore regular filters
- Dimension filters, top-N selections, and sets: evaluated together
- Flexible-grain calculations: respect dimension filters
- Measure filters: operate on aggregated values (analogous to SQL HAVING)
- Table calculations: computed locally on the final result set
- Visual-level filters: hide marks without recomputing
Critical Scenarios Where Order Matters:
Example 1 - Top N with Geographic Filter: You want "Top 10 products sold in Europe." If Region is a standard dimension filter and Product Top N is configured normally, the Top N evaluates first on global data, then the Region filter intersects that set—often yielding fewer than 10 products. Solution: promote Region to a context filter so the Top N operates on European sales only.
Example 2 - Cohort Calculations:
A fixed-grain calculation like {FIXED Customer: MIN(OrderDate)} for first-purchase date ignores standard dimension filters—correct behavior for cohort analysis since you want the true first purchase regardless of current category filters. If you need filter interaction, move that filter to context or data source level.
Example 3 - Table Calculation Denominators: When computing percent-of-total, filtering at the dimension level changes both numerator and denominator. If you want to filter display but keep the full denominator, use a table calculation as the filter—it executes last and hides marks after percentages are computed.
Part 3: Performance Optimization Strategies
Context Filter Selection: Promote only highly selective, infrequently changed filters (Region that cuts 90% of rows, fiscal year for historical analysis). Each change to a context filter rebuilds the intermediate subset. A context filter that retains most rows costs more than it saves. Permanent restrictions belong in cache-creation or data source filters instead.
Cache Size Reduction (Highest Impact):
- Retain only necessary time windows (exclude ancient history)
- Hide all unused columns—even invisible columns consume storage and processing
- Aggregate to the visualization grain: if dashboards show daily trends, cache daily aggregates rather than transaction-level detail
- Apply filters for geography, product categories, or other scope limitations during cache creation
A well-tuned cache for 100M transaction rows often compresses to under 10M aggregate rows.
Calculation Efficiency: Table calculations execute client-side on the result set. Running totals across a million marks, nested window functions, or index-based filtering on large views are expensive. Push logic upstream: use level-of-detail calculations, database computed columns, or materialized views. Keep visible mark counts low.
Schema Design Trade-offs: For direct connections, denormalized wide tables or materialized views minimize joins and deliver fastest query performance, at the cost of storage and refresh complexity. Multi-table normalized schemas with proper foreign keys allow the BI tool to query only necessary tables per visualization.
For cached data, a single denormalized table loads fastest. Multi-table caches preserve flexibility but add overhead.
Bottleneck Diagnosis: Use the platform's query profiler to distinguish between slow database execution versus slow rendering. Slow queries suggest indexing, partitioning, or denormalization in the warehouse. Slow rendering suggests too many marks, complex table calculations, or excessive dashboard elements.
Part 4: Critical Migration Pitfall
Silent Result Changes from Filter Order Differences:
Different BI platforms implement filter execution order differently. A dashboard that relies on specific precedence—such as a fixed-grain calculation that must execute before dimension filters, or a top-N that depends on context filter order—will produce different numbers if the new platform processes filters in a different sequence.
Mitigation: During migration, audit every level-of-detail calculation, top-N configuration, and complex filter interaction. Test with known datasets and compare outputs. Explicitly document which filters must execute in which order, and verify the target platform supports that sequencing through context promotion, data source filters, or custom SQL pre-filtering.
Additional Common Mistakes:
Row-level security implementation differs significantly between platforms. Database-enforced security in a direct connection doesn't automatically transfer to cache-based security rules—these must be explicitly rebuilt. Incremental refresh logic (append-only vs lookback windows vs update-aware) varies by platform and can cause data staleness or duplication if not reconfigured.
Common Mistakes to Avoid
- Choosing cache vs direct based on familiarity rather than freshness, cost, and concurrency requirements
- Promoting too many filters to context, causing frequent expensive recomputations
- Ignoring cache aggregation opportunities, storing transaction-level detail when aggregates suffice
- Assuming filter execution order is universal across BI platforms during migration
- Implementing table calculations for logic that should be pushed to the database
- Overlooking row-level security differences between database-native and BI-native enforcement