pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Findout long unused tables in database
6+ messages / 4 participants
[nested] [flat]

* Findout long unused tables in database
@ 2022-09-26 12:05 Andreas Fröde <psql@andreas.spider-net.de>
  2022-09-27 04:25 ` Re: Findout long unused tables in database Laurenz Albe <laurenz.albe@cybertec.at>
  2022-09-27 06:35 ` Re: Findout long unused tables in database Andreas Kretschmer <andreas@a-kretschmer.de>
  0 siblings, 2 replies; 6+ messages in thread

From: Andreas Fröde @ 2022-09-26 12:05 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hello,
I am looking for a way to find out when a table was last used for 
reading. (Without writing every statement in the logfile or putting a 
trigger on it). Is there such a thing?


CIAO
andreas





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Findout long unused tables in database
  2022-09-26 12:05 Findout long unused tables in database Andreas Fröde <psql@andreas.spider-net.de>
@ 2022-09-27 04:25 ` Laurenz Albe <laurenz.albe@cybertec.at>
  2022-09-27 05:35   ` Re: Findout long unused tables in database Andreas Fröde <psql@andreas.spider-net.de>
  1 sibling, 1 reply; 6+ messages in thread

From: Laurenz Albe @ 2022-09-27 04:25 UTC (permalink / raw)
  To: Andreas Fröde <psql@andreas.spider-net.de>; pgsql-general@lists.postgresql.org

On Mon, 2022-09-26 at 14:05 +0200, Andreas Fröde wrote:
> I am looking for a way to find out when a table was last used for 
> reading. (Without writing every statement in the logfile or putting a 
> trigger on it). Is there such a thing?

No, there is no way to do that short of logging all statements.

I expect that removing permissions on a table and checking whether
your application hits an error is not an option...

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Findout long unused tables in database
  2022-09-26 12:05 Findout long unused tables in database Andreas Fröde <psql@andreas.spider-net.de>
  2022-09-27 04:25 ` Re: Findout long unused tables in database Laurenz Albe <laurenz.albe@cybertec.at>
@ 2022-09-27 05:35   ` Andreas Fröde <psql@andreas.spider-net.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Andreas Fröde @ 2022-09-27 05:35 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi Laurenz,


> No, there is no way to do that short of logging all statements.

Thank you for the quick if unfortunate reply.

> I expect that removing permissions on a table and checking whether
> your application hits an error is not an option...

I will try to suggest this. :-)

Have a nice day.

Andreas





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Findout long unused tables in database
  2022-09-26 12:05 Findout long unused tables in database Andreas Fröde <psql@andreas.spider-net.de>
@ 2022-09-27 06:35 ` Andreas Kretschmer <andreas@a-kretschmer.de>
  2022-09-27 12:12   ` Re: Findout long unused tables in database Andreas Fröde <andreas@spider-net.de>
  2022-09-27 15:59   ` Re: Findout long unused tables in database Laurenz Albe <laurenz.albe@cybertec.at>
  1 sibling, 2 replies; 6+ messages in thread

From: Andreas Kretschmer @ 2022-09-27 06:35 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org



Am 26.09.22 um 14:05 schrieb Andreas Fröde:
> Hello,
> I am looking for a way to find out when a table was last used for 
> reading. (Without writing every statement in the logfile or putting a 
> trigger on it). Is there such a thing?
>

no really what you are looking for, i know, but we have 
pg_stat_user_tables. There can you find how often the table was queried 
in the past. Take the data, wait some time, take it again and compare.



Regards, Andreas

-- 
Andreas Kretschmer
Technical Account Manager (TAM)
www.enterprisedb.com






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Findout long unused tables in database
  2022-09-26 12:05 Findout long unused tables in database Andreas Fröde <psql@andreas.spider-net.de>
  2022-09-27 06:35 ` Re: Findout long unused tables in database Andreas Kretschmer <andreas@a-kretschmer.de>
@ 2022-09-27 12:12   ` Andreas Fröde <andreas@spider-net.de>
  1 sibling, 0 replies; 6+ messages in thread

From: Andreas Fröde @ 2022-09-27 12:12 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi Andreas,


> no really what you are looking for, i know, but we have 
> pg_stat_user_tables. There can you find how often the table was queried 
> in the past. Take the data, wait some time, take it again and compare.

Thanks for this idea. i will try it out.

Andreas





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Findout long unused tables in database
  2022-09-26 12:05 Findout long unused tables in database Andreas Fröde <psql@andreas.spider-net.de>
  2022-09-27 06:35 ` Re: Findout long unused tables in database Andreas Kretschmer <andreas@a-kretschmer.de>
@ 2022-09-27 15:59   ` Laurenz Albe <laurenz.albe@cybertec.at>
  1 sibling, 0 replies; 6+ messages in thread

From: Laurenz Albe @ 2022-09-27 15:59 UTC (permalink / raw)
  To: Andreas Kretschmer <andreas@a-kretschmer.de>; pgsql-general@lists.postgresql.org

On Tue, 2022-09-27 at 08:35 +0200, Andreas Kretschmer wrote:
> 
> 
> Am 26.09.22 um 14:05 schrieb Andreas Fröde:
> > Hello,
> > I am looking for a way to find out when a table was last used for 
> > reading. (Without writing every statement in the logfile or putting a 
> > trigger on it). Is there such a thing?
> > 
> 
> no really what you are looking for, i know, but we have 
> pg_stat_user_tables. There can you find how often the table was queried 
> in the past. Take the data, wait some time, take it again and compare.

Ah, that is the best solution.  I should have thought of that.

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2022-09-27 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 12:05 Findout long unused tables in database Andreas Fröde <psql@andreas.spider-net.de>
2022-09-27 04:25 ` Laurenz Albe <laurenz.albe@cybertec.at>
2022-09-27 05:35   ` Andreas Fröde <psql@andreas.spider-net.de>
2022-09-27 06:35 ` Andreas Kretschmer <andreas@a-kretschmer.de>
2022-09-27 12:12   ` Andreas Fröde <andreas@spider-net.de>
2022-09-27 15:59   ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox