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 1n8OHw-0005fa-18 for pgsql-docs@arkaria.postgresql.org; Fri, 14 Jan 2022 15:14: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 1n8OHu-0003Ff-Rh for pgsql-docs@arkaria.postgresql.org; Fri, 14 Jan 2022 15:14:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8OHu-0003FW-Kc for pgsql-docs@lists.postgresql.org; Fri, 14 Jan 2022 15:14:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8OHs-0008It-9c for pgsql-docs@lists.postgresql.org; Fri, 14 Jan 2022 15:14:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20EFEfKl3379158; Fri, 14 Jan 2022 10:14:41 -0500 From: Tom Lane To: chris+postgresql@qwirx.com cc: pgsql-docs@lists.postgresql.org Subject: Re: Why can NUMERIC columns not use deduplication? In-reply-to: <164216867903.23277.10737033258186320533@wrigleys.postgresql.org> References: <164216867903.23277.10737033258186320533@wrigleys.postgresql.org> Comments: In-reply-to PG Doc comments form message dated "Fri, 14 Jan 2022 13:57:59 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3379156.1642173281.1@sss.pgh.pa.us> Date: Fri, 14 Jan 2022 10:14:41 -0500 Message-ID: <3379157.1642173281@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Doc comments form writes: > "64.4.3. Deduplication" says: > "numeric cannot use deduplication. Numeric display scale must be preserved > among equal datums." > However I don't understand this. An equal datum is an equal datum regardless > of display scale, isn't it? No. For example: regression=# select 1.0, 1.00; ?column? | ?column? ----------+---------- 1.0 | 1.00 (1 row) regression=# select 1.0 = 1.00; ?column? ---------- t (1 row) These values are "equal" per the datatype's equality operator, but there are some operations (not only output) that can distinguish them, so the index can't lump them together. There are similar issues in some other datatypes, for example zero and minus zero in the float types. regards, tom lane