I want to remove unused information stored in some columns in a table. The table though is undocumented and I gradually try to find out what column is used for.

A better view upon table usage is to find which columns of this tablwe are less used so I can further investigate the use of them.

What I want to find out are columns that are written once and rarely are being used in Select or update statements. Is there a way to find out this information from information_schema?

I am using postgresql

  • 1
    Use pgaudit to write alerts to the log file whenever something accesses the relevant column. Be patient, though, since a column might only be used once a month or less, but is vital when needed.
    – RonJohn
    Commented May 24, 2023 at 7:49
  • Even worse, there might be a legal requirement to keep the data for 7 years.
    – RonJohn
    Commented May 24, 2023 at 7:51
  • 1
    Unless it’s a blob column using a significant amount of disk space, just leave it alone.
    – RonJohn
    Commented May 24, 2023 at 7:52
  • @RonJohn well yeah I keep note on that. Commented May 24, 2023 at 9:01
  • Also @RonJohn I jave a vague idea about the db therefore I can target to speficic tables that I can know that receive frequent inserts and updates. Commented May 24, 2023 at 11:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.