首页 > 解决方案 > Log all PostgreSQL queries to a table, not a file

问题描述

Through this question:

How to log PostgreSQL queries?

I know I can log PostgeSQL queries to a file, but what if I want to log those queries to a table rather than a file? I know that this is doable in Redshift and MySQL, but how do I achieve the same on PostgreSQL?

标签: postgresqllogging

解决方案


你不能这样做。

但是您可以使用该csvlog格式,定期轮换日志文件并将其加载到带有COPY.

有关详细信息,请参阅文档

我认为直接登录数据库是个坏主意,因为性能太差了,这很可能成为你的性能瓶颈。


推荐阅读