-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Caching parsing/analysis of Query Grammar #2816
Comments
Hm, I'm not sure what your goal is. Do you want to:
If you wanted to hash the values, too, you could just use the whole query string for the hash, no parsing required. If not... then you'd need to parse way too much of the actual structure of the request before you could actually calculate the hash - you'd almost be there in that case. The |
Yes, only the structure. But as you mention that's not worth it. SEARCH looks good. My motivation is that with #2523 and #1582 we're going to be putting more work at the Plan level. That will certainly not be zero cost in terms of perf. #2771 will prove how much time we take for parsing/planning. |
Problem
There are several steps we do for each request to become a generated query. e.g. for a GET:
postgrest/src/PostgREST/App.hs
Lines 167 to 173 in 1f13e43
Before that:
postgrest/src/PostgREST/App.hs
Lines 148 to 153 in 1f13e43
Solution
Akin to "prepared statements", implement "prepared requests". We can make a hash of our input parameters and store the generated query. Then just execute the query using the arguments.
Notes
?id=eq.3&col=lt.4
) is not possible. If we switched to a grammar like?id.eq=3&col.lt=4
(https://github.com/PostgREST/postgrest/issues/2066`) it might be possible to avoid our query grammar parsing and only do some lighter parsing.SEARCH/QUERY
HTTP method to pass arguments in request body for read request #2125 (comment)) and only have placeholder parameters on the query params then it should be possible to completely avoid parsing.The text was updated successfully, but these errors were encountered: