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 1o91b0-0008Vk-I0 for pgsql-general@arkaria.postgresql.org; Wed, 06 Jul 2022 09:45:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o91ay-0000th-B9 for pgsql-general@arkaria.postgresql.org; Wed, 06 Jul 2022 09:45:20 +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 1o91ax-0000pU-Vo for pgsql-general@lists.postgresql.org; Wed, 06 Jul 2022 09:45:20 +0000 Received: from mout.gmx.net ([212.227.17.22]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o91av-0005N3-U2 for pgsql-general@lists.postgresql.org; Wed, 06 Jul 2022 09:45:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1657100716; bh=jmT7QGzNEe67g8bdGZo5PteP8hHoxH/rCu4YSYWGcHY=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=E07LQkTRpfuXto1HDTemWHWKE1DgudFPZZlXwWfgRGWJ1PUeuotiZZ4p9GBwAkO2P Gl94oemMpJXGPlMio6XQPxI8XkBuguDNkqD7URRzGEFDlPEDB300fUmNuE13G2FsFq wtb2BPevvtKPNYcX0FOywZVa1AtepEfCCgUxAB2M= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([84.190.232.104]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mo6qp-1npeCm3nbP-00pbo0 for ; Wed, 06 Jul 2022 11:45:16 +0200 Received: from ncq by hermes with local (Exim 4.94.2) (envelope-from ) id 1o91as-00048T-EE for pgsql-general@lists.postgresql.org; Wed, 06 Jul 2022 11:45:14 +0200 Date: Wed, 6 Jul 2022 11:45:14 +0200 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: lifetime of the old CTID Message-ID: References: <20220705075119.GA23@sh4-5.1blu.de> <03ca00a881de408016a907e31d832175b04aeac7.camel@cybertec.at> <20220705102201.GA9@sh4-5.1blu.de> <1c03b94b606f493bc6448b8559c4cccf806d3607.camel@cybertec.at> <9B418AE6-EA48-4493-B1D1-566708ADC9AC@thebuild.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) Sender: X-Provags-ID: V03:K1:zHSlWCY93hmwWEJ6qTt/LRH0L80kuG0OedcvCbvIdeb0cGi5HiI xz0jOCSiG1Y7OSK4qsP9RILFSGVormteWuP+HLuoRfcfB0JvHae8bj7KOPrOhXce9WNry0y OynrsDUSMwBtd/XYv9FqFAUbI32h5Y1QT+om7fsqBm4wwpTCBmwhmo8dcAg+NmEqU1tF5S8 c43jK1cZJEqg6oKzIGZHA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:YGvFW6/JQkw=:iC8LeMaNdfDVlE3m4s8egR seYhoHQ25PgdTkE3wPdWlmaJIxR/IaOa1T3nnyb1qHwkY6Do9w1HH6g5kLrHW4f/FRwpV828K hgO5kM2HYSrrYiEAVowd5EBWF+u8n//JKzUSATINYVz2dNiy5BwR4rX70vWOiK2Oc83yHxwwx ksPc5pw5TNOanxbuEa2TpIje9mM5aZR4tR+rJoscJdJsVuLdqL9SgiixO+hbfk/uAXaRc38i7 i37v2uoVOk10GRrKyiCObFZF0fy/qJDHThwLmHhE7ZdkwDfUY+w1bgWq+5baC0xVz+/XLQ8rO ztw5KfIybDvex+6A7WQLEacLu2KRcbHp/a1osZpNE5jcgydZviMYZc+MZh+Nwb/4+onwpV+vw MjXV50d8O2suq1HLPEBqUw2zetLIoNt3BJSZWXvhD8PaD5/poAKAcyovvLt1YZSFtiAJ9iza1 hHHYSL8JUHVa1D8VjsLxn5Zu70WOS/mpEU+fkuX+x0k/FZhCht0lNWzE23J9LR8TvwnWpv9Jl JbAQDFxZrMUFqQL4VCmD+i7kg5YJP2BZYbrU6lGwJ6KQgogkoZOqsKkgLoX9xD8Gs0CeyHckq bfmBjIOIfksSkHLCOCa+d1+R5Z9To9CHrpvVdBFR7x8waS7KDFWXJN8aGgVAZwGm04ja8ZTAy KulVNXKXmyvVvdm+/b6SL7wxqArNDUkUnemIpZs6XevAawPTUxeWpXb0MuYnNiTgl8q/tnofu 1G64EsmDMRUzcJHFqOmc80XXy+8RhzaugCkdKPx8igieZ8nW5c3T8Nyp4woSVYG1p4H3T6C7X 3n2kG9lszcc+H1x0H50/tKdCGqdTVQVP0GcoX682OrUh/MfpQjV6wq5drmsIpoUhlbY/D0M7Z TEKah1L9rltmNyu2ADIIApk1l7IOHxfU7qaXahKeOarNVacjkCVi+kixSjQrZBilcVkxWi7t4 miBh1jCD+pym+/nMITFH/KEgnKjRFL1TmwDjvlkO5qM/D2TwJDoxSiYhgB+TpSoIeBV1XtKHJ 2/Khr5fC0eNuWpFKeF7Nc2YHSHrbIG+KkjBbWJu1vxzWKN6gSeG/rdihrhtaasK4CdqvBXR7n XfA8gddCwvffQDnTxTJhfPeHSdRGcwSzFQPL2oX4SAB9z8I+n/eneh6ZX8g6xiV4ggjrLaLeC dTeDQcpjdWopL8khDtBV9MJyW6 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Am Wed, Jul 06, 2022 at 08:18:42AM +0200 schrieb Matthias Apitz: > > On first glance, it appears that you are using the ctid as a primary k= ey for a row, and that's highly not-recommended. The ctid is never intend= ed to be stable in the database, as you have discovered. There are really= no particular guarantees about ctid values being retained. > > > > I'd suggest having a proper primary key column on the table, and using= that instead. > > Ofc, each table has its own primary key(s), used for example for the > SELECT ctid, * FROM d01buch WHERE ... > > As I said, we came to PostgreSQL from Sybase (and Oracle) and Sybase has > for each table a so called SYB_IDENTITY_COLUMN which is static for the > table and its value does not change. When we would add now to some 400 t= ables an > additional INTEGER column (and triggers to fill this on INSERT) this > would be a big change in our DB layer and migration of databases in the > field. Your suggesting (thanks for it in any case) is not that easy to > implement, and no option at the moment. Christopher suggested to *use* the primary key, not to *add* one. You said that there *is* a primary key. So, more thought/explanation would need to go into why that cannot be used. Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B