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.96) (envelope-from ) id 1woRpv-00144w-17 for pgsql-general@arkaria.postgresql.org; Mon, 27 Jul 2026 20:22:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1woRps-00Eu00-1F for pgsql-general@arkaria.postgresql.org; Mon, 27 Jul 2026 20:22:04 +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.96) (envelope-from ) id 1woRpr-00Etzs-37 for pgsql-general@lists.postgresql.org; Mon, 27 Jul 2026 20:22:04 +0000 Received: from mout02.posteo.de ([185.67.36.66]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1woRpo-00000000dGp-3mIo for pgsql-general@postgresql.org; Mon, 27 Jul 2026 20:22:02 +0000 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E4BA1240101 for ; Mon, 27 Jul 2026 22:21:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=1984.8680eb; t=1785183715; bh=PowDpv8NlH3gP+K/0pvr35E95kxMzrrYQOBxpp3Gb4Q=; h=MIME-Version:Date:From:To:Subject:Message-ID:Content-Type: Content-Transfer-Encoding:From; b=Xjut/VhaUPJwbt/ToCt8CTbwYcFHHOhrwW1mRPIfToO0T5+B0OsLulTtF8xilgAvO VbfsbjK7D9O0T5w6pUV2ay4G7nNsNp7IpyOlPuSJ/aFEphvBceO+a/8n8hwNxPXzpT AGP/ItECRMaAH8jFSSG2sctIvCEcjjb3OL9WGcP7P4ruXD5Ys+cwAwJxvurqJHGl2Z Ws+s8uE35EQUw70otJNcF0g+C8A81gDRc9AxY4vQRLu3vtQmP/d6m9QLRItYPa7l4i tzQOVuzhMAopjiyFMXV6yFb01nEqG/SCIhBlZFfCyGEMZgVsrtQt0N+vRBlkVUNvf6 +Dgl7az+/0kNw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4h89434Rp2z6tw8 for ; Mon, 27 Jul 2026 22:21:55 +0200 (CEST) MIME-Version: 1.0 Date: Mon, 27 Jul 2026 20:21:55 +0000 From: pgmis@posteo.net To: pgsql-general@postgresql.org Subject: PG19: guidance on temporal tables use for auditable link entities Message-ID: <79fa6dc9d70d2d62331f4ec11f4dbac7@posteo.net> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, PG19 comes with shiny new temporal tables feature which i would like to explore - and i would like to ask for some guidance. It is about modeling link entities which need to be auditable. In checking options what fits best I've come to two options: 1. having the table as insert only with a surrogate key column, created_at/by, deleted_at/by columns and possibly a deleted flag (to move it between partitions); delete would be a soft-delete updating a flag and two audit columns; relinking would mean a new insert and some checks would have to be enforced so only one record can exist with an open interval (for a combination of linked entities of course) 2. using temporal table where deletion is just an update to close the range Using temporal tables would mean replacing two created_at/deleted_at columns with one range column valid_at. Since this is a range type, i assume simple btree would be maybe a problem? In any case could someone maybe give some more insight into the following questions: - how will indexing work in the case of the tsrange column in PG19? is there any change given a range type being shown as part of the PK? - since temporal tables are now an advertised (and rather cool) feature, will btree_gist become part of core? there has been some "fix inet mess" thread reagarding this, but im not really sure what the outcome is. - will using only btree on a primary key composite key have significant performance impact when searching for active rows? - would temporal tables be even be recommended for usage i mentioned above or i should stick with option 1)? Thank you, Miroslav.