public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Al Grant <[email protected]>
To: [email protected]
Subject: Re: Postgres DB design Question (High Level)
Date: Thu, 19 Jun 2025 07:00:54 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAODtcdfiMuXAFDiJpB-0QMS6PeUy-WMOHAjaL8q5k-489Fg7SA@mail.gmail.com>
References: <CAODtcdfiMuXAFDiJpB-0QMS6PeUy-WMOHAjaL8q5k-489Fg7SA@mail.gmail.com>

On Thu, 2025-06-19 at 16:50 +1200, Al Grant wrote:
> I want to create a web based dashboard for all the currently detected
> signals, where the dashboard contains a graph of the daily beep rate
> for each channel (max 100 channels) over user selectable periods from
> 1 week to 1 year - that query does not scale well if I query the bpm
> table.
> 
> To avoid this I have created a bpm summary table which is generated
> periodically (hourly) off the bpm table. The bpm summary table
> contains the dominant beep rate for a given hour (so 2 records per day
> per channel assuming a signal is detected).
> 
> Does this summary table approach make sense?

Yes.  Pre-aggregation to reduce the data volume is common in a
data warehouse.  Ideally, you don't have to scan the entire base
table to create the summary.  You can consider a trigger for that,
but more elegant might be a solution based on partitioning, where
you aggregate a partition once it is complete.

> I have noted that I am periodically syncing from MySQL to the server,
> and then periodically updating the summary table - its multi stage
> syncing and I wonder if that makes this approach fragile (although I
> don't see any alternative).

"MySQL" and "fragile" in the same sentence.  Sounds about right.

Yours,
Laurenz Albe






view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Postgres DB design Question (High Level)
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox