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:Step 3: Add Project and Document Constraints
Always define project and document constraints in your domain model. These are resolved early in the query pipeline and dramatically reduce the result set before other filters are applied:Step 4: Limit Navigation Property Expansion Depth
Deeply nested expand clauses cause cascading queries. Each expansion level triggers additional database lookups:Step 5: Use Count and Any for Validation
When you only need to check whether results exist (not fetch all data), the query engine supports efficient operations:- Count queries return the number of matches without fetching entities
- Any queries stop at the first match (short-circuit evaluation)
Step 6: Enable Query Debug Logging
To identify slow queries, enable debug logging on the Polarion server. The query engine logs each executed query with:- The prototype being queried
- The full Lucene query string
- The result count
- A preview of the first 5 returned items
Check your Polarion server’s logging configuration for the exact log level and category needed to enable query debug output.
Performance Decision Matrix
| Scenario | Recommendation |
|---|---|
| Loading all items of a type | Add project + document constraints |
| Filtering by string value | Use eq instead of contains where possible |
| Checking if items exist | Use any query instead of full fetch |
| Deep hierarchy display | Limit expand depth to 2-3 levels |
| Large result sets (1000+) | Add additional filter predicates |
| Cross-project queries | Specify explicit project ID list |
Verify
After applying optimization changes:- Open the powersheet document and note the load time
- You should now see faster initial data loading compared to before
- Check Polarion server logs for the query execution output to confirm efficient Lucene queries
- Compare the number of in-memory post-filter operations — fewer is better
See Also
- Write an Entity Query — query structure fundamentals
- Use Predicates — predicate syntax reference
- Filter by Document — document scoping for performance
- Filter by Project — project scoping for performance
- Expand Navigation Properties — controlling expansion depth
Sources
Sources
Source Code
PolarionQueryProcessor.javaQueryExecutorTest.javaGenericQueryResolver.javaprod-powersheet-src/com.nextedy.powersheet.client/src/modules/ModelProvider/ModelProvider.tsxprod-powersheet-src/com.nextedy.powersheet.client/src/modules/QueryManager/QueryManager.tsx