# Optimization of stored query execution in EHRBase **Category:** [Platform](https://discourse.openehr.org/c/platform-implem/7) **Created:** 2021-06-03 08:34 UTC **Views:** 597 **Replies:** 5 **URL:** https://discourse.openehr.org/t/optimization-of-stored-query-execution-in-ehrbase/1598 --- ## Post #1 by @Dileep_V_S As per my understanding AQL gets compiled into SQL for execution. In stored queries, are the AQLs being pre-compiled so that it does not have to be done every time it is used? --- ## Post #2 by @birger.haarbrandt Hi Dileep, no, there is no such optimization at the moment. --- ## Post #3 by @Dileep_V_S Have you done any analysis on the potential improvement this can give? Is this in your roadmap? --- ## Post #4 by @birger.haarbrandt I don't think this would provide value. Queries are already cached. Are you facing any issues at the moment? --- ## Post #5 by @Dileep_V_S I have not faced any problem. Just a thought regards --- ## Post #6 by @birger.haarbrandt That's good to hear! We could actually think about providing a convenince feature that would allow you to provide a further parameter when creating a stored query to allow the creation of secondary indexes. Just an idea, there might be some practical issues to that. --- **Canonical:** https://discourse.openehr.org/t/optimization-of-stored-query-execution-in-ehrbase/1598 **Original content:** https://discourse.openehr.org/t/optimization-of-stored-query-execution-in-ehrbase/1598