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 1pMXKq-0004c6-Rh for pgsql-general@arkaria.postgresql.org; Mon, 30 Jan 2023 16:48: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 1pMXKp-0005Dm-B4 for pgsql-general@arkaria.postgresql.org; Mon, 30 Jan 2023 16:48:47 +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 1pMXKo-0005BZ-W4 for pgsql-general@lists.postgresql.org; Mon, 30 Jan 2023 16:48:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pMXKn-0003eP-1D for pgsql-general@lists.postgresql.org; Mon, 30 Jan 2023 16:48: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 30UGmhIJ497566; Mon, 30 Jan 2023 11:48:43 -0500 From: Tom Lane To: Dominique Devienne cc: veem v , Miles Elam , pgsql-general@lists.postgresql.org Subject: Re: Sequence vs UUID In-reply-to: References: <214765350.744944.1674770109151@office.mailbox.org> <9864e7fa-27c7-95ac-b9a7-e1ebc4824740@gmail.com> <1015127885.422245.1674938371999@office.mailbox.org> Comments: In-reply-to Dominique Devienne message dated "Mon, 30 Jan 2023 17:37:42 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <497564.1675097323.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Jan 2023 11:48:43 -0500 Message-ID: <497565.1675097323@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dominique Devienne writes: > On Mon, Jan 30, 2023 at 5:11 PM veem v wrote: >> CREATE TABLE test1_UUID ( id bigint,source_id varchar(36) PRIMARY KEY, = Name varchar(20) ); > Maybe if you used a "native" 16-byte uuid, instead of its textual > serialization with dashes (36 bytes + length overhead), the gap would > narrow. Yeah, especially if your database is not using C locale. The strcoll or ICU-based comparisons done on string types can be enormously more expensive than the memcmp() used for binary types like native uuid. regards, tom lane