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 1vEVaB-00CYjB-Vw for pgsql-general@arkaria.postgresql.org; Thu, 30 Oct 2025 16:33:03 +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 1vEVaA-009ZuC-Ud for pgsql-general@arkaria.postgresql.org; Thu, 30 Oct 2025 16:33:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vEVaA-009Zu3-74 for pgsql-general@lists.postgresql.org; Thu, 30 Oct 2025 16:33:01 +0000 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vEVa7-004ao8-14 for pgsql-general@lists.postgresql.org; Thu, 30 Oct 2025 16:33:00 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id B63121D00124; Thu, 30 Oct 2025 12:32:58 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Thu, 30 Oct 2025 12:32:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1761841978; x=1761928378; bh=iujkN60yoQDT+0Mr+eguYSWXoqZ/AhlwUzzdHwHbdJ0=; b= XpvX3++OcHL6wpkEjV35Jqk0wK9do5AF/sBqgnJzqEF6PP1km0z73J94wrO8kxGO zJrxElP9YBZs9xv++KW5AGpdn5F77YOEoZ8cdsMW6xAIyvYps/iI9fkGZTsH56rj kp9pcwybltPMyIm7Dsu+ClcbrDhohKlsrYYBD8Ch2uz2NgUyEThS9GMzWQtQH8yi Wyp9f8zXSEodxZgOqq6AFqltvVB3AMM9sF5ejBFGq+mtzOR4DTizz0xzF/90ntqS 3t78pFz/z5Q8OCQ4f+S8MXSNV5alDotF3TDrU064yJSp0u228VFU+XpsU1yTrrdw m3Il2ETBz9xDeXfjTg3zDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1761841978; x= 1761928378; bh=iujkN60yoQDT+0Mr+eguYSWXoqZ/AhlwUzzdHwHbdJ0=; b=L 00nBN9+a65uGxcMOGpgDoKByoxCOWaQuike0ohpvetZsJl1JXHKZe9X5feah0OdP hz1d2pQaxvSWcKLEfYc+YvLXQiwrZGoGwWlC6OCO2rfaf4XLL9i7azYaAvJf2e17 yOCaFlGLG6kj8kvrQIE8PosKLmj87XDQFi/cnHeLjhc3eW28j1U/t0LN+MMhh3cd OdVsxZtCEioP37qd/TH9rIQQAVD8EcGTjS0HTcIH6w+3kmjjdKCVnM359K7eieH+ 3q6ZSAkrgYCHo2eKY3Dzrzv2FDBV9CQNo2PDkqex57bQK++lfe1W7d6C56tiiiqj HCNGC2knDOFgI49yC9XfQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduieejtdelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepgfdufeekhfevfeelveeiueevhedvuddukeduvddvlefh ueeuieejtdeuvdevvdeunecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgr nhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopeefpdhmoh guvgepshhmthhpohhuthdprhgtphhtthhopehrghhrrghvvghnshesghhmrghilhdrtgho mhdprhgtphhtthhopegtohhlihhnthhhrghrthesghhmrghilhdrtghomhdprhgtphhtth hopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhr gh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 30 Oct 2025 12:32:57 -0400 (EDT) Message-ID: <77e6127d-2d1f-440e-b9fe-e1a523ff1329@aklaver.com> Date: Thu, 30 Oct 2025 09:32:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Two sequences associated with one identity column To: Rumpi Gravenstein Cc: Colin 't Hart , PostgreSQL General References: <4c41582a-83ee-4500-abde-e44a0f3d3895@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: 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 On 10/30/25 08:22, Rumpi Gravenstein wrote: > I've seen two indexes created on the same table/column when you create a > primary key as part of table create ddl and then also run a separate > create index statement for the same table/column. Yes it is possible to create two indexes on a given table column, the issue here though is, from this post: https://www.postgresql.org/message-id/CAMon-aQ0Zs-Otkp1%3Dzk3WYt7Am-_oQHKEmD_rZ1CNGBAgM_jzw%40mail.gmail.com The two indexes are coming from: -- -- Name: ; Type: SEQUENCE; Schema: ; Owner: -- ALTER TABLE . ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( SEQUENCE NAME . START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); -- -- Name: ; Type: SEQUENCE; Schema: ; Owner: -- ALTER TABLE . ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( SEQUENCE NAME . START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); That is two GENERATED ALWAYS AS IDENTITY sequences being created for the PK. That should not happen. > > On Thu, Oct 30, 2025 at 10:42 AM Adrian Klaver > > wrote: > > On 10/30/25 01:55, Colin 't Hart wrote: > >           relname          | relnamespace | relpersistence > > --------------------------+--------------+----------------o > >     |    524799410 | p > >     |    524799410 | p > > (2 rows) > > > > Well so much for that guess. I was exploring the idea that the sequence > may have been unlogged at some point and you had both a logged(p) and > unlogged(u) instance of each. > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > > > > > -- > Rumpi Gravenstein -- Adrian Klaver adrian.klaver@aklaver.com