-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toggles for caching exceptions in in-memory query cache #56
Comments
[previous example was not appropriate and removed.]
A downside of this method is, even if t1 gets updated, query result of v1 does not automatically get updated. You need to execute a "dummy update" (e,g, update v1 set id = 1 where id = 1) or drop/re-create v1. |
Actually more safer dummy update would be: BTW, this method (using view) cannot be used if the SELECT in question uses joins because PostgreSQL's updatable view does not allow to use joins. |
I think defining the reasonable "category" for everyone is difficult as each user has their own use case. |
This seems to work after testing. However, the tables I use in my queries tend to be generated dynamically; having to generate a view for each of them, and adding the views to the configuration every time, would be non-trivial.
This would be perfect for me, though, if that could be implemented. Thank you! |
I have posted a patch to implement this in the master branch. I change the comment string to "/FORCE QUERY CACHE/" as it seems cleaner to users. |
The patch has been committed. |
Recognize /*FORCE QUERY CACHE*/ SQL statement comment so that any read only SELECT/with queries are cached. This is opposite to /*NO QUERY CACHE*/ comment. This feature should be used carefully. See the manual for more details. Discussion: #56
The documentation says:
I'm facing a use-case with Grafana, where I wish to cache some heavy queries being made on some dashboards. These queries frequently feature timestamps with timezones or somesuch, functions running on timestamps, etc. I'm using pgpool in raw mode for that, as the caching functionality is all I wish to use.
However, despite moving these queries around, there always seems to be some element somewhere or other that triggers the immutability filter in pgpool, and renders the queries I want uncacheable.
Would it be possible to add a configuration toggle for each of the big "categories" of caching exceptions, such that one can bypass this initial filtering? I understand the footguns involved (in particular with non-immutable functions, timestamps with timezones potentially giving different results, ...), but in my specific use case, these do not really matter as there is only one well-known client requesting this information.
Thank you in advance.
The text was updated successfully, but these errors were encountered: