Setting a statement_timeout
The statement_timeout[116] can be set from the client application to set a maximum allowed time for statements. When the time is reached, the statements are canceled. A statement_timeout is set in Rideshare in the config/database.yml.
When queries are canceled for taking too long, they’ll need to be fixed so they run in less time. This is especially crucial for user-facing queries, although even queries for background jobs should be sped up when they’re excessively long.
Setting too low of a value for statement_timeout cancels queries unnecessarily. Not setting it at all means queries are allowed to run forever, consuming limited resources like database connections. A happy middle ground is to set a reasonable statement_timeout ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access