Thanks Mayuri for your comment. Actually querying DB with LLM is still in the experimental phase and there are still a lot of open threads here.
A lot of things need to be standardized and perfected before making it production ready. Additionally, there are security concerns too that need to be addressed to prevent unwanted data leakages.
To answer your question about how optimized the query is, right now there is no benchmarking tool to measure it. Also, the response from the LLMs is non-deterministic, if ask the same question to LLM twice it might happen that both times it may return with 2 different answers. So in our case, it might be possible that the first time it returns with an optimized query and the second time it may return with an optimized query.