-1

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?

Laurenz Albe
  • 167,868
  • 16
  • 137
  • 184
rodrigocf
  • 1,705
  • 11
  • 35
  • 53

1 Answers1

0

You cannot do that.

But you can use the csvlog format, rotate the log file regularly and load it into a table with COPY.

See the documentation for details.

I think that it is a bad idea to log directly into a database, because the performance is bad enough that this is likely to become your performance bottleneck.

Laurenz Albe
  • 167,868
  • 16
  • 137
  • 184