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 1qmzsd-009eyZ-9D for pgsql-general@arkaria.postgresql.org; Sun, 01 Oct 2023 17:05:19 +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 1qmzsa-00DiGz-Ve for pgsql-general@arkaria.postgresql.org; Sun, 01 Oct 2023 17:05:16 +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 1qmzsa-00DiGP-G4 for pgsql-general@lists.postgresql.org; Sun, 01 Oct 2023 17:05:16 +0000 Received: from mx3.wp.pl ([212.77.101.10]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qmzsW-007dhU-Rq for pgsql-general@lists.postgresql.org; Sun, 01 Oct 2023 17:05:15 +0000 Received: (wp-smtpd smtp.wp.pl 45297 invoked from network); 1 Oct 2023 19:04:42 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1696179882; bh=jPCjFoFHnsel+lQhFj6jzo2BkBjSjUe9GJen7exKuZ0=; h=Subject:To:From; b=wpHgz0Gq3Xl4W/z9x9DkyYMj18hPJ9+u+R3EdF0IFl8OM3wUENWh0EyS5GssyaROQ GxGdsn//tu8nafy/IcCwvNoaZ4a8W/+/VNfsgffZtmKSmxZ7Icuez83x3+FMfL8/Mj DEeaQpSdXYYOkLs+/o23rt8yd/KMlUzo7/XXfZ1w= Received: from 83.6.244.232.ipv4.supernova.orange.pl (HELO [10.0.0.202]) (ipluta@wp.pl@[83.6.244.232]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 1 Oct 2023 19:04:42 +0200 Message-ID: <624e0261-2c7b-01cf-ec30-3c1e04af2b89@wp.pl> Date: Sun, 1 Oct 2023 19:04:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: Gradual migration from integer to bigint? To: James Healy , pgsql-general@lists.postgresql.org References: Content-Language: pl-PL From: Ireneusz Pluta In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-WP-MailID: e984b155d00860387732c77542c17597 X-WP-AV: skaner antywirusowy Poczty Wirtualnej Polski X-WP-SPAM: NO 0000009 [sNN0] List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk W dniu 30.09.2023 o 07:55, James Healy pisze: > ... > We shouldn't have let them get so big, but that's a conversation > for another day. > > Some are approaching overflow and we're slowly doing the work to > migrate to bigint. Mostly via the well understood "add a new id_bigint > column, populate on new tuples, backfill the old, switch the PK" > method. The backfill is slow on these large tables, but it works and > there's plenty of blog posts and documentation to follow. wouldn't wrapping to negative numbers like: https://www.youtube.com/watch?v=XYRgTazYuZ4&t=1338s be a solution for you? At least for buying more time for the slow migration process. Or even as a definite solution if you now take care and not let the keys grow too quickly.