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 1tC5Ac-00Azhc-Lj for pgsql-admin@arkaria.postgresql.org; Fri, 15 Nov 2024 22:52:05 +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 1tC5Aa-00C99o-29 for pgsql-admin@arkaria.postgresql.org; Fri, 15 Nov 2024 22:52:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tC5AZ-00C99Z-N8 for pgsql-admin@lists.postgresql.org; Fri, 15 Nov 2024 22:52:04 +0000 Received: from tunnel173844-pt.tunnel.tserv13.ash1.ipv6.he.net ([2001:470:7:2e6::2] helo=sloth.crazybean.net) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tC5AW-0029O9-Gy for pgsql-admin@postgresql.org; Fri, 15 Nov 2024 22:52:03 +0000 Received: from smtpclient.apple ( [2001:470:e117:4:506a:ca05:99aa:144f]) by sloth.crazybean.net (OpenSMTPD) with ESMTPSA id 93471091 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Fri, 15 Nov 2024 17:51:59 -0500 (EST) From: Rui DeSousa Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_C1F1AEBB-9C9A-42EE-8B26-B0D295AA63D0" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: PostgreSQL historical database Date: Fri, 15 Nov 2024 17:51:58 -0500 In-Reply-To: Cc: Erik Serrano , Samed YILDIRIM , Pgsql-admin , pgsql-admin To: Keith Fiske References: X-Mailer: Apple Mail (2.3696.120.41.1.10) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_C1F1AEBB-9C9A-42EE-8B26-B0D295AA63D0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Nov 5, 2024, at 1:15 PM, Keith Fiske = wrote: >=20 > I would first recommend looking into partitioning for managing data = retention like this. I don=E2=80=99t think you need partitioning. The is so many ways to = slice this problem. =20 You need some form of logical replication. I=E2=80=99ve used both of = these methods in the past to do exactly the issue at hand. These are = not the only solutions. 1, Queue tables via triggers and then asynchronous replicate those = transaction to the archive database in real time.=20 2. Messages queues; Modern application make use of massage queues; Just = attach the archive database to the same message queue. I don=E2=80=99t see a need for partitioning. I managed a Muti-terabyte = content delivery platform where the data was only licensed between 30 to = 90 days. Records where being purged more or less just as fast as new = records were being created. In essence the database was completely = reloaded with new data every 30-90 days depending on the data stream. = We did no use any form of partitioned tables and had no performance = issues. --Apple-Mail=_C1F1AEBB-9C9A-42EE-8B26-B0D295AA63D0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Nov 5, 2024, at 1:15 PM, Keith Fiske <keith.fiske@crunchydata.com> wrote:

I would first recommend looking = into partitioning for managing data retention like = this.

I = don=E2=80=99t think you need partitioning.  The is so many ways to = slice this problem.  

You need some form of logical replication.  I=E2=80=99ve = used both of these methods in the past to do exactly the issue at hand. =  These are not the only solutions.

1, Queue tables via triggers and then = asynchronous replicate those transaction to the archive database in real = time. 
2. Messages queues; Modern application = make use of massage queues; Just attach the archive database to the same = message queue.

I= don=E2=80=99t see a need for partitioning.  I managed a = Muti-terabyte content delivery platform where the data was only licensed = between 30 to 90 days.  Records where being purged more or less = just as fast as new records were being created.  In essence the = database was completely reloaded with new data every 30-90 days = depending on the data stream.  We did no use any form of = partitioned tables and had no performance issues.
= --Apple-Mail=_C1F1AEBB-9C9A-42EE-8B26-B0D295AA63D0--