Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1od4C4-0006cc-Ed for pgsql-general@arkaria.postgresql.org; Tue, 27 Sep 2022 06:35:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1od4C2-0005fd-Om for pgsql-general@arkaria.postgresql.org; Tue, 27 Sep 2022 06:35:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1od4C2-0005Xo-D5 for pgsql-general@lists.postgresql.org; Tue, 27 Sep 2022 06:35:46 +0000 Received: from mail.i-mark.de ([188.138.104.222]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1od4Bz-0000AP-Hb for pgsql-general@lists.postgresql.org; Tue, 27 Sep 2022 06:35:45 +0000 Received: from [192.168.178.20] (unknown [185.38.49.17]) by mail.i-mark.de (Postfix) with ESMTPSA id 7252C1584B30 for ; Tue, 27 Sep 2022 08:35:38 +0200 (CEST) Authentication-Results: loft7616.startdedicated.de; spf=pass (sender IP is 185.38.49.17) smtp.mailfrom=andreas@a-kretschmer.de smtp.helo=[192.168.178.20] Received-SPF: pass (loft7616.startdedicated.de: connection is authenticated) Message-ID: Date: Tue, 27 Sep 2022 08:35:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: Findout long unused tables in database Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <3d837584-aca0-a8c1-a78b-442071ec723f@andreas.spider-net.de> From: Andreas Kretschmer In-Reply-To: <3d837584-aca0-a8c1-a78b-442071ec723f@andreas.spider-net.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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