Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sidUC-007Jwm-Ek for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Aug 2024 17:26:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sidU9-00CSpz-UI for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Aug 2024 17:26:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sidU9-00CSpr-IO for pgsql-hackers@lists.postgresql.org; Mon, 26 Aug 2024 17:26:34 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sidU6-001cay-7B for pgsql-hackers@postgresql.org; Mon, 26 Aug 2024 17:26:33 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-39d34be8b6dso18505895ab.0 for ; Mon, 26 Aug 2024 10:26:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724693190; x=1725297990; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=TtfTl7SJ2xgJwQzI8T2maVG1NXDbZEXVDOYZu2KS1gA=; b=Sh7M+7O9EgUZLcFJofvZS/s/1GAXbw7bGO2EcLyspteVP5PA2ozjdOmvhUw5Zz6yoV vQ6O2XS7TaBkRbUL4AulxuXXQNP7Ztc0Fo4jAo9CotkrYcf4p/2xSteKHK8lXkcwcws/ CBynOKigmAMV2ocBZ4FSvHHj0Qi7ZA/9m2WLt2CfQnWBoSuzbUJQ4Mp4d3q9v/RlLMDO uTanoZtAR8QrXnidnKWO7rlsququIZ9s3v4z5hsysY+/tUNEUwRVRrLKsTxZ5tYL0iYu T8kH7n2riqk9zQ0BNnhsb5jUL1h2SmfUSTptk8mUHAAgRHjIyGm02FtOnTPJlVysCJQh JSLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724693190; x=1725297990; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TtfTl7SJ2xgJwQzI8T2maVG1NXDbZEXVDOYZu2KS1gA=; b=NaTXx43j+9eO7WQDw24HO+5ccL9gnWuXIXQkrFNHVHLNKNrciE5M7R2Cbs5nFmVLbc i1kGZmeJEERM1m41afPvHyLxYI1eOo9RezvEf/AHpWvEGv1Pv10dGaprb4SlfFAKeOeK wHylPTYXlW0cpz4k6HqSTUS2fEKe6NAs3kwCsrwjay0pA5Gt608UDXn1iufpEo+hwv5C OPT1HZNmhxOIhbum6HkdBMSukeR+4c7G/FtHQ0cvbhB8TkhOmYDHy3wL3Y8ZdUY1ox7Z ufu5rnJ1C7Z4n0+V6eI05ZNaCMtemfN2mN9UXBW1rTO/R+90WjrqQz9kc5wYrI8p/+8W jMJQ== X-Gm-Message-State: AOJu0Yw45Cu8r0sFf0J6cH1cpFxuj66mHiOcpVhECsZOPutk+OI0KXw2 ScQ4AS9Q1qLSgAui6J78tErOV2iAJBLJjfnoYcPSgVJbhuWPik4m X-Google-Smtp-Source: AGHT+IG8xcyOXchJA0CDWq/iGeG/n9UcHwK1Of9R8tuAHBR1FIx9dCQivlXJh/Wclcuw2KkYbFtCZA== X-Received: by 2002:a05:6e02:16c6:b0:375:9dd4:d693 with SMTP id e9e14a558f8ab-39e63e3a95emr6062055ab.3.1724693189709; Mon, 26 Aug 2024 10:26:29 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ce710b9b50sm2264244173.122.2024.08.26.10.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 10:26:29 -0700 (PDT) Date: Mon, 26 Aug 2024 12:26:27 -0500 From: Nathan Bossart To: Ayush Vatsa Cc: PostgreSQL Hackers , michael@paquier.xyz Subject: Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Aug 26, 2024 at 09:14:27PM +0530, Ayush Vatsa wrote: > Given the situation, I see two potential paths forward: > *1/ Reintroduce Support for Sequences in pgstattuple*: This would be a > relatively small change. However, it's important to note that the purpose > of pgstattuple is to provide statistics like the number of tuples, dead > tuples, and free space in a relation. Sequences, on the other hand, return > only one value at a time and donīt have attributes like dead tuples. > > [...] > > *2/ Explicitly Block Sequence Support in pgstattuple*: We could align > sequences with other unsupported objects, such as foreign tables, by > providing a more explicit error message. While it is apparently pretty uncommon to use pgstattuple on sequences, this is arguably a bug that should be fixed and back-patched. I've CC'd Michael Paquier, who is working on sequence AMs and may have thoughts. I haven't looked at his patch set for that, but I'm assuming that it might fill in pg_class.relam for sequences, which would have the same effect as option 1. I see a couple of other places we might want to look into as part of this thread. Besides pgstattuple, I see that pageinspect and pg_surgery follow a similar pattern. pgrowlocks does, too, but that one seems intentionally limited to RELKIND_RELATION. I also see that amcheck explicitly allows sequences: /* * Sequences always use heap AM, but they don't show that in the catalogs. * Other relkinds might be using a different AM, so check. */ if (ctx.rel->rd_rel->relkind != RELKIND_SEQUENCE && ctx.rel->rd_rel->relam != HEAP_TABLE_AM_OID) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("only heap AM is supported"))); IMHO it would be good to establish some level of consistency here. -- nathan