Prerequisites
- A working powersheet document with configured data sources
- Familiarity with entity queries and predicates
- Access to Polarion server logs for debug output
Step 1: Understand the Query Processing Pipeline
When Powersheet loads data, each query goes through a processing pipeline that translates your configuration into Polarion Lucene queries. Understanding this pipeline helps you write efficient queries.- Lucene-compatible predicates execute as database queries (fast)
- Complex predicates execute as in-memory post-filters after fetching (slow for large datasets)
Step 2: Prefer Lucene-Compatible Predicates
Simple equality, comparison, and null checks translate directly to Lucene and execute efficiently. Structure yourwhere clause to use these operators:
and at the top level automatically, so flat predicate structures perform best:
Step 3: Add Project and Document Constraints
Always define project and document constraints in your domain model. The query engine resolves these early in the pipeline, dramatically reducing the result set before other filters apply:where clause predicates are evaluated.
For dynamic document scoping, use applyCurrentDocumentTo in your constraints so the sheet automatically filters to the current LiveDoc without hardcoding document paths:
Step 4: Limit Navigation Property Expansion Depth
Deeply nestedexpand clauses cause cascading queries. Each expansion level triggers additional database lookups for related entities:
Step 5: Optimize Sort Clauses
Sorting interacts with query performance. ThesortBy configuration determines the order of returned results:
designRequirement.title) requires the server to resolve relationships before sorting, which adds overhead.
When no
sortBy is specified, results come back in Polarion’s default order (typically by work item ID). Specify outlineNumber asc for document-ordered display.Step 6: Scope Enum Sources Efficiently
Powersheet auto-discovers enum properties from metadata and dynamically creates data sources for dropdown pickers. Each enum source generates a query to fetchEnumOption entities. To avoid unnecessary queries:
- Only include enum columns in views where they are needed
- Use constraints on enum queries to limit results to the relevant project and work item type
- The auto-discovery uses
polarionType,projectId, andenumIdmetadata to build targeted queries
Step 7: Enable Query Debug Mode
To identify slow queries, use theexplain query parameter. The server logs each executed query with details:
- The entity type being queried
- The full Lucene query string generated from your predicates and constraints
- The result count
- A preview of the first returned items
Check your Polarion server’s logging configuration for the exact log level and category needed to enable query debug output. The
explain parameter in query configuration enables additional diagnostic information.Performance Decision Matrix
| Scenario | Recommendation | Impact |
|---|---|---|
| Loading all items of a type | Add project + document constraints | High |
| Filtering by string value | Use eq instead of contains where possible | High |
| Deep hierarchy display | Limit expand depth to 2—3 levels | High |
| Large result sets (1000+) | Add narrowing predicates to where clause | High |
| Cross-project queries | Specify explicit project ID constraints | Medium |
| Multiple enum columns | Use views to load only visible enum sources | Medium |
| Sort by related entity field | Sort by direct properties instead | Low |
Verify
After applying optimization changes:- Open the powersheet document and note the initial load time
- You should now see faster data loading compared to before your changes
- Check Polarion server logs for query execution output to confirm Lucene queries are being generated (not in-memory post-filters)
- Compare the predicate split — fewer post-filter operations means better performance
- Test with views that hide deep expansion columns to confirm they load faster
See Also
- Write an Entity Query — query structure fundamentals
- Use Predicates — predicate operator reference
- Filter by Document — document scoping techniques
- Expand Navigation Properties — controlling expansion depth
- Query Baseline or Revision — historical query considerations
- Configure Sources — data source setup
Sources
Sources
Source Code
PolarionQueryProcessor.java— query splitting and constraint resolutionQueryFactory.java— Lucene query construction from constraintsQueryManager.tsx— client-side query building with document contextOrderByClause.java— sort clause validation and processingModelProvider.tsx— metadata initialization and enum source discovery