Search Postgresql Archives

Re: Advice on efficiently logging outputs to PostgreSQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Oct 15, 2024, at 07:17, Dominique Devienne <ddevienne@xxxxxxxxx> wrote:
> Am I worrying too much? :)

Probably. :-)  The main things I'd worry about is:

1. What's the ratio of log lines to database updates?  You want this to be as high as usefully possible, since in effect you are doing write amplification by writing to the logs as well as to the "real" database.

2. One of the things to watch out for if you are writing the log lines to the database is that if you write a log line in a transaction, and that transaction rolls back, you lose the log line.  That may or may not be what you want: if it's reporting an error (such as the reason that the transaction rolled back), you want to preserve that data.  One way of handling this is to have the application have a separate session for logging, although you are now doing 2x the number of connections.

If the write volume is very high, you might consider using a dedicate log-ingestion service (there are tons) rather than PostgreSQL, so that you aren't overburdening the database with log activity.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux