There are a number of common errors that can be easily identified through the logs. Understanding these errors and analyzing can help you in the process of continuous database improvement.
Then you will understand the most common ones so that you can take the necessary action in order to solve them.
Queries that take longer than 2 seconds are logged automatically so that you can identify and optimize your code. These logs are generated in the following format:
[8-2] g0afa5bjht [GOLD] LOG: duration: 63.697 ms statement: SELECT "courses".* FROM "courses"...
If there are large numbers of these logs, probably your application has performance problems. A good recommendation is to try to reduce the execution time of your queries by 10 ms. You can achieve this optimization by adding indexes or using the EXPLAIN
command from PostgreSQL to understand the performance issues in your query.