Prerequisites
- A working powersheet document with configured data sources
- Familiarity with entity queries and predicates
- Access to Polarion server logs for debug output
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.
The query engine splits predicates into two categories:
- Lucene-compatible predicates execute as database queries (fast)
- Complex predicates execute as in-memory post-filters after fetching (slow for large datasets)
Prefer Lucene-Compatible Predicates
Simple equality and comparison operators translate directly to Lucene and execute efficiently. Structure your Avoid mixing complex logical groupings when simple predicates will do. The query engine handles
where clause to use these operators:and at the top level automatically, so flat predicate structures perform best:Add Project and Document Constraints
Always define project and document constraints in your data model. The query engine resolves these early in the pipeline, dramatically reducing the result set before other filters apply:Project and document constraints work together as pre-filters. The query engine converts them to Lucene clauses that narrow the search scope before your This injects the current document ID as a query parameter, scoping results to the active document context.
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:Limit Navigation Property Expansion Depth
Deeply nested The expand clause is converted internally to dot-notation strings for the query protocol. Each level adds another round of relationship resolution on the server.
expand clauses cause cascading queries. Each expansion level triggers additional database lookups for related entities:Optimize Sort Clauses
Sorting interacts with query performance. Inside a Keep sort properties simple and aligned with indexed Polarion fields. Sorting by navigation property paths (e.g.,
query: block, use orderBy to determine the order of returned results. (Note that sortBy is a separate sheet-level option that belongs at the YAML root, not inside query:.)designRequirement.title) requires the server to resolve relationships before sorting, which adds overhead.When no
orderBy is specified, results come back in Polarion’s default order (typically by work item ID). Specify outlineNumber asc for document-ordered display.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 fetch
EnumOption 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
Enable Query Debug Mode
To identify slow queries, use the
explain 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