Today I Learned

2022/01/09

postgres

1: That you can set statement timeouts:

ALTER DATABASE mydatabase SET statement_timeout = '60s';

Source: https://blog.crunchydata.com/blog/five-tips-for-a-healthier-postgres-database-in-the-new-year

2: that you can query your cache and index hit metrics (src)

3: writes to indexed columns don’t necessarily update indices:

If an indexed column has to have new values inserted, or existing values updated or deleted, the corresponding index does get updated as well. Ironically, that might make queries take more time to evaluate. If write operations are frequently run against a particular column then you may need to more carefully evaluate creating an index here.

If there’s only one thing you take away from this blog post, I hope it’s this: success with indexes will involve some planning, investigation, and maintenance!

https://blog.crunchydata.com/blog/three-easy-things-to-remember-about-postgres-indexes