Problem
Currently we support setting a statement_timeout per role and per function, but we don't have a way to support it per table or view or when resource embedding is used.
Solution
Send the timeout through an HTTP header.
The above is the Timeout header from WebDAV (ref), but it has WebDAV specific semantics so I don't think we can reuse it.
A saner option would be a Prefer header:
Prefer: handling=strict, timeout=2
Some drawbacks I can see is that this can be used to force failure by end users if the statement_timeout is set to a value too low (this in turn can pollute logs). For this maybe we can only allow seconds, instead of milliseconds. So only 1 second as minimum.
This timeout should also have a threshold, it cannot be too high. This threshold could be the role timeout or the function timeout.
Problem
Currently we support setting a statement_timeout per role and per function, but we don't have a way to support it per table or view or when resource embedding is used.
Solution
Send the timeout through an HTTP header.
Timeout: Second-2The above is the Timeout header from WebDAV (ref), but it has WebDAV specific semantics so I don't think we can reuse it.
A saner option would be a Prefer header:
Prefer: handling=strict, timeout=2Some drawbacks I can see is that this can be used to force failure by end users if the
statement_timeoutis set to a value too low (this in turn can pollute logs). For this maybe we can only allow seconds, instead of milliseconds. So only 1 second as minimum.This timeout should also have a threshold, it cannot be too high. This threshold could be the role timeout or the function timeout.