Thread

  1. Monitoring object usage?

    Colin 't Hart <colinthart@gmail.com> — 2010-09-15T11:56:48Z

    Hi,
    
    I'm trying to get a grip on a new body of code and a Postgres database that
    I'm working with. In particular I've been tasked with cleaning up the
    database.
    
    Is there a way in Postgres to enable monitoring on tables and columns to
    determine what's not actively being used?
    
    This would then form input for a more thorough check into the code base to
    see what's really not being used.
    
    
    Thanks & cheers,
    
    Colin
    
  2. Re: Monitoring object usage?

    Jayadevan M <jayadevan.maymala@ibsplc.com> — 2010-09-15T12:28:35Z

    Hi,
    
    > From: "Colin 't Hart" <colinthart@gmail.com>
    > To: pgsql-general@postgresql.org
    > Date: 15/09/2010 17:37
    > Subject: [GENERAL] Monitoring object usage?
    > Sent by: pgsql-general-owner@postgresql.org
    > 
    > Hi,
    > 
    > I'm trying to get a grip on a new body of code and a Postgres 
    > database that I'm working with. In particular I've been tasked with 
    > cleaning up the database.
    > 
    > Is there a way in Postgres to enable monitoring on tables and 
    > columns to determine what's not actively being used?
    > 
    > This would then form input for a more thorough check into the code 
    > base to see what's really not being used.
    > 
    
    Would the log_statement mentioned here help?
    http://www.postgresql.org/docs/current/static/runtime-config-logging.html
    I guess it will result in huge log files if it is a 'busy' database. 
    Probably this has a performance penalty too.
    
    Regards,
    Jayadevan
    
    
    
    
    
    DISCLAIMER: 
    
    "The information in this e-mail and any attachment is intended only for 
    the person to whom it is addressed and may contain confidential and/or 
    privileged material. If you have received this e-mail in error, kindly 
    contact the sender and destroy all copies of the original communication. 
    IBS makes no warranty, express or implied, nor guarantees the accuracy, 
    adequacy or completeness of the information contained in this email or any 
    attachment and is not liable for any errors, defects, omissions, viruses 
    or for resultant loss or damage, if any, direct or indirect."
    
    
    
    
    
    
    
  3. Re: Monitoring object usage?

    Tomas Vondra <tv@fuzzy.cz> — 2010-09-15T12:37:39Z

    Well, you can see usage statistics for tables, indexes, functions and
    sequences ... but AFAIK it's not possible to do that for columns.
    
    See this
    http://www.postgresql.org/docs/8.4/static/runtime-config-statistics.html
    and then use pg_stat_ and pg_statio_ catalogs
    (http://www.postgresql.org/docs/8.4/static/monitoring-stats.html) to find
    objects that were not accessed recently (numbers are 0 or do not change
    anymore, etc.).
    
    But be careful as this may backfire quite easily - imagine an index that's
    used only in a batch processing the end of month. You could easily decide
    it's not necessary and drop it, causing a disaster.
    
    Tomas
    
    > Hi,
    >
    > I'm trying to get a grip on a new body of code and a Postgres database
    > that
    > I'm working with. In particular I've been tasked with cleaning up the
    > database.
    >
    > Is there a way in Postgres to enable monitoring on tables and columns to
    > determine what's not actively being used?
    >
    > This would then form input for a more thorough check into the code base to
    > see what's really not being used.
    >
    >
    > Thanks & cheers,
    >
    > Colin
    >