Skip to content

Per-request timeout #4381

@steve-chavez

Description

@steve-chavez

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.

Solution

Send the timeout through an HTTP header.

Timeout: Second-2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumHaskell task involving PostgreSQL IO

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions