schema Cleanning

Started by salah jubehabout 15 years ago4 messagesgeneral
Jump to latest
#1salah jubeh
s_jubeh@yahoo.com

Hello,

I am trying to drop deprecated tables, views, procedures from an existing
database, I am checking the pg_stat_user_tables view to check if the tables are
accessed recently also to check live tuples. For deprecated views and
procedures, I am wondering How can I do that, for example suppose the table is
used and there is a view defined using this table but no one is using it. Is
there is away to check the views statistics.

Regards

#2salah jubeh
s_jubeh@yahoo.com
In reply to: salah jubeh (#1)
Re: schema Cleanning

Hello Guys,

This is a simple way to check if there is no activity on the table,

SELECT relname,seq_tup_read,idx_tup_fetch FROM pg_stat_user_tables
WHERE (idx_tup_fetch + seq_tup_read)= 0;

Is there is any way to make similar checks on views

Regards

________________________________
From: salah jubeh <s_jubeh@yahoo.com>
To: pgsql-general@postgresql.org
Sent: Mon, February 21, 2011 4:53:41 PM
Subject: [GENERAL] schema Cleanning

Hello,

I am trying to drop deprecated tables, views, procedures from an existing
database, I am checking the pg_stat_user_tables view to check if the tables are
accessed recently also to check live tuples. For deprecated views and
procedures, I am wondering How can I do that, for example suppose the table is
used and there is a view defined using this table but no one is using it. Is
there is away to check the views statistics.

Regards

#3Guillaume Lelarge
guillaume@lelarge.info
In reply to: salah jubeh (#2)
Re: schema Cleanning

Le 23/02/2011 09:10, salah jubeh a �crit :

[...]
This is a simple way to check if there is no activity on the table,

SELECT relname,seq_tup_read,idx_tup_fetch FROM pg_stat_user_tables
WHERE (idx_tup_fetch + seq_tup_read)= 0;

Is there is any way to make similar checks on views

No, there's no stats on views.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

#4salah jubeh
s_jubeh@yahoo.com
In reply to: salah jubeh (#1)
Re: schema Cleanning

Hello,

Exactly, I want to drop unused tables, views, etc..., I am writing now a shell
script to handle this issue by analyzing the log files. If you have suggestions
and comments I will be glade to hear it.

Regards

________________________________
From: Michael Black <michaelblack75052@hotmail.com>
To: s_jubeh@yahoo.com
Sent: Wed, February 23, 2011 11:57:01 PM
Subject: RE: [GENERAL] schema Cleanning

I do not know what your criteria is for dropping things. But I would be very
sure that something is no longer used. For example, some tables are not used
but once a quarter or once a year. And the same is true with views and
procedures. But that would also depend on the type of data like accounting or
inventory verses customer. Just some thoughts.

Michael

________________________________
Date: Wed, 23 Feb 2011 00:10:03 -0800
From: s_jubeh@yahoo.com
Subject: Re: [GENERAL] schema Cleanning
To: s_jubeh@yahoo.com; pgsql-general@postgresql.org

Hello Guys,

This is a simple way to check if there is no activity on the table,

SELECT relname,seq_tup_read,idx_tup_fetch FROM pg_stat_user_tables
WHERE (idx_tup_fetch + seq_tup_read)= 0;

Is there is any way to make similar checks on views

Regards

________________________________
From: salah jubeh <s_jubeh@yahoo.com>
To: pgsql-general@postgresql.org
Sent: Mon, February 21, 2011 4:53:41 PM
Subject: [GENERAL] schema Cleanning

Hello,

I am trying to drop deprecated tables, views, procedures from an existing
database, I am checking the pg_stat_user_tables view to check if the tables are
accessed recently also to check live tuples. For deprecated views and
procedures, I am wondering How can I do that, for example suppose the table is
used and there is a view defined using this table but no one is using it. Is
there is away to check the views statistics.

Regards