1-Click Index Advisor
Slow mobile database queries usually stem from missing indexes on frequently filtered or joined columns. VetroLog’s Index Advisor analyzes your queries in real time and generates optimal SQLite indexes with a single click.
⚡ How Index Advisor Works
graph TD A["User SQL Query"] --> B["AST & Keyword Analysis: WHERE, JOIN, ORDER BY"] B --> C["Fetch Existing Indexes via PRAGMA index_list"] C --> D{"Is Index Missing?"} D -->|Yes| E["Generate CREATE INDEX Statement"] D -->|No| F["Mark as Optimal Index Coverage"] E --> G["Calculate Estimated Speedup (e.g. 25x)"] G --> H["1-Click Apply Index to Phone Database"]- Query Analysis:
- Inspects
WHEREclauses (equality filtersstatus = 'ACTIVE', range filterscreated_at > ?). - Inspects
JOINconditions (ON f._id = p.farmer_id). - Inspects
ORDER BYandGROUP BYtargets.
- Inspects
- Catalog Cross-Referencing:
- Inspects existing database indexes using SQLite’s
PRAGMA index_listandPRAGMA index_info. - Ignores columns that are already indexed or covered by Primary Keys.
- Inspects existing database indexes using SQLite’s
- Composite Index Recommendations:
- When multiple columns are filtered together, suggests compound indexes ordered by equality columns first, followed by range/sort columns.
🎯 1-Click Index Application
When a missing index is detected:
- Switch to the Index Advisor tab in the bottom panel.
- Review the recommended statement:
CREATE INDEX IF NOT EXISTS idx_farming_practices_farmer_idON farming_practices(farmer_id);
- Check the heuristic explanation and estimated performance gain (e.g.
~20x - 80x speedup). - Click Apply Index:
- VetroLog executes the
CREATE INDEXstatement directly on the mobile device. - The sidebar schema tree automatically updates to reflect the new index.
- Re-running the query now converts the high-cost
SCANnode into an optimalSEARCH ... USING INDEXnode!
- VetroLog executes the

💡 Best Practices for Mobile SQLite Indexing
- Index Selective Columns: Add indexes to columns with high cardinality (e.g.
uuid,email, foreign keys). - Avoid Over-Indexing: Every index consumes additional disk space and slightly slows down
INSERToperations. VetroLog advises creating only indexes that genuinely benefit frequent read paths.
Next Steps
- Verify query latency against mobile frame budgets in the Performance Profiler.
- Export your optimized queries into native code with the Code Generator.