Optimize the performance of your app
Learn how to optimize Ninox app performance with efficient queries, triggers, and data handling.
The following best practices are key recommendations that have proven effective. They address common pitfalls such as inefficient data access, unwanted trigger cascades, and loop-intensive computations. Consistently applying these guidelines can help reduce load times and conserve system resources.
Optimize initial views for large tables
When working with large tables, filter the initial view to display only a relevant subset of records—specifically, only those that are needed. This significantly improves load performance and enhances the user experience.
Avoid conflicting or circular triggers
Ensure that triggers are designed to operate independently and do not interfere with one another. In particular, avoid configurations that may cause circular references or unintended trigger loops, as these can lead to unpredictable behavior and performance issues.
Use select statements sparingly
Only use select statements when absolutely necessary. If references to the target table already exist, leverage those instead. For accessing related data in sub-tables, prefer dot notation over select statements to improve performance and maintain clarity.
❌ Avoid:
sum((select invoice_items where invoice = i).total)✅ Use this instead:
let me := this;
sum((Invoice_items[invoice = me]).total)Minimize select statements in function fields
Avoid using select statements within function fields displayed in table or form views whenever possible. If a select statement is required, use the where clause for defining conditions instead of square bracket syntax [...].
Avoid repeated select executions
When a select statement is required in a script, execute it only once and store the result in a variable. Reuse this variable to access multiple fields as needed. This approach enhances performance and reduces redundant database operations.
Avoid select statements in nested loops
Wherever possible, refrain from using select statements within nested loops. This pattern can lead to significant performance degradation due to repeated database access. Instead, consider retrieving data in advance and using cached data.
Prefer writing static values over repeated formula evaluation
Instead of recalculating formulas dynamically each time ("on the fly"), consider writing static values to data fields using triggers, provided it is appropriate and beneficial. This reduces processing overhead and improves overall system efficiency.
Optimize searches in table views from dashboard form views
When performing searches in table views via a form view or page, define all variables using let before executing the search with a select statement. To optimize performance, limit the results to avoid loading unnecessary data. Additionally, use the not command to properly handle empty search fields and ensure accurate filtering.
Avoid storing large text blocks in text fields
Refrain from storing large content directly in text or HTML fields, for example, CSV files, Base64 files, or JSON payloads for API calls. Since Ninox logs every change, this can lead to an excessively large change history and impact performance. A better approach is to generate such content using createTextFile() and store it as an attachment.
You can then access the file using the API or the following function:
Use indexing selectively
Apply indexing thoughtfully only to fields that are frequently searched and benefit from faster access. Fields with limited value sets, such as Yes/No fields, typically do not require indexing. Learn more here.
Last updated
Was this helpful?