Yes, Maciej is right.. I think that the best approach is to decouple those queries from the runtime session. You can directly get the information from the history logs or some custom listener that you can attach to the session to store information in a different storage.
Cheers