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 1od29p-0000Ru-Q1 for pgsql-general@arkaria.postgresql.org; Tue, 27 Sep 2022 04:25:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1od29n-0002LE-BN for pgsql-general@arkaria.postgresql.org; Tue, 27 Sep 2022 04:25:19 +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 1od29m-0002L3-SP for pgsql-general@lists.postgresql.org; Tue, 27 Sep 2022 04:25:19 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1od29k-0007Ur-1O for pgsql-general@lists.postgresql.org; Tue, 27 Sep 2022 04:25:17 +0000 Received: by mail-ej1-x62a.google.com with SMTP id z13so18172756ejp.6 for ; Mon, 26 Sep 2022 21:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date; bh=BO+zsdmOBO/2PPZ05L5FyMa1mxnXAOhKhDWvgGGX9KA=; b=JKQ7hhtZC0QEgrgI6QAsOg+yBhQdLOjt5q9L/s4Pb/uwXrPwjLSdffj1q3dgVxNgbt bj5Upv5CD5g8lq6l2vUmlkOm5ttY2Bdc8IcsUbS+p1oGcLtZNxY9sOd16+lHME58RLHi Jhf4UkW5vYYxPeseHqZvcyOcCZFsEr68h8OY7X6+rwaaUJ4wQaV02YHz94kKsuAFlwrd 3TLP4cQNyqHpZouqUFiBcmwCTcMREaIB4+XyPR7JCOSoI0ij/vPhqzkV02eQgK3hU9sc toamZmuBJeMedNGtBEA19koXhDDOqR+uaerlmqa58LsXY7Bhsyrz3Je+huXWiTw7pJmH lbwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date; bh=BO+zsdmOBO/2PPZ05L5FyMa1mxnXAOhKhDWvgGGX9KA=; b=392snFodgrt9qtlZgDcGzQIZwVw0jeMxnPLppFRetjvmvl9neVW7euryMyHdn1+ZKF rtYKSdzvjqcZYZsRZoMRvHmOqm6gmGFZBW49rx624MBvEUZgX1yE9xktGOGR5cx312Ry BvsL+OaWiRNP/q6jTJMwWF3Lo6PI+gaHiVpcLD5ZQNLbnb+i8ksYqUU1u6af12lPH4zh cWUlA+FkmaqUcUe1n/9BjPlGXUfYbYDOmjO8GiM5ExRv/Drf5F+UPNsFverU1PF8hHYe pnySEH1gNPxd5WIMPCTOmjtqw0Upz4Z2YlsL+ct2XxHCBiXsNm0HUbb2FxSb/aGWS0y2 kPPA== X-Gm-Message-State: ACrzQf1QtmNxg5ivD9XYKpRNCz3dU2Z3UFpWWdItzi6c8wljP9pCWtK/ DCgsloAVVlyG7JYWT4v2dkoJRL2jrGMOVg== X-Google-Smtp-Source: AMsMyM5tGhecbfaFoeq9VXaNp1RHPn6Jt0HbF0IX1+w4LNYBUddUEPMEb5GxXDJD1OHthU3dH7jfDA== X-Received: by 2002:a17:907:6d28:b0:782:32ad:7b64 with SMTP id sa40-20020a1709076d2800b0078232ad7b64mr22725323ejc.23.1664252714381; Mon, 26 Sep 2022 21:25:14 -0700 (PDT) Received: from localhost.localdomain (62-47-144-47.adsl.highway.telekom.at. [62.47.144.47]) by smtp.gmail.com with ESMTPSA id z21-20020aa7cf95000000b004575c9db638sm402807edx.54.2022.09.26.21.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 21:25:13 -0700 (PDT) Message-ID: Subject: Re: Findout long unused tables in database From: Laurenz Albe To: Andreas =?ISO-8859-1?Q?Fr=F6de?= , pgsql-general@lists.postgresql.org Date: Tue, 27 Sep 2022 06:25:13 +0200 In-Reply-To: <3d837584-aca0-a8c1-a78b-442071ec723f@andreas.spider-net.de> References: <3d837584-aca0-a8c1-a78b-442071ec723f@andreas.spider-net.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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