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 1uS7W9-003cah-NA for pgsql-general@arkaria.postgresql.org; Thu, 19 Jun 2025 05:08:53 +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 1uS7W7-007lzp-QJ for pgsql-general@arkaria.postgresql.org; Thu, 19 Jun 2025 05:08:52 +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 1uS7W7-007lzQ-Fq for pgsql-general@lists.postgresql.org; Thu, 19 Jun 2025 05:08:52 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uS7W6-002oMa-1L for pgsql-general@lists.postgresql.org; Thu, 19 Jun 2025 05:08:51 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-ad8a6c202ffso62736366b.3 for ; Wed, 18 Jun 2025 22:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750309729; x=1750914529; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JjLuuIB0go9X/3azZO8jE5xZcgi3BxH0UEdvE0Bdgjg=; b=WJ0mNard5dJ0RsPjR4iiE/BMrKfu8Pil/e0hHNdabS/q7I28a0dnhWprZHhWGLwONn wh/87TLIAXMbYtys8e78EKty5+FSsr/IZd/o76f0B38coHX6pi/xhkKQQ/XoNw1YUDxw Y/tGlRwpUEYpzjMhY2gFxE/scgVcKrqWD+JcgBSCybgnYCPpuHm9AGFbZxwfWRyKcMLR 2Wa9ts4EhDm2c8LVN9NiaeUL4jlmwXCFLoXeZdaDCdzI2Q8Pvz/noae1vYGG8IXv0RTN cIlDKR+YeaL7aLlaN3hkdfy4sqa3INt7gv/xfMnCKTvZDH4uxfIIg45ZD85CGYaVA89I ABVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750309729; x=1750914529; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JjLuuIB0go9X/3azZO8jE5xZcgi3BxH0UEdvE0Bdgjg=; b=DFGtPysXMHIjNMOyRJ/LhA2cwf2K8ZurO9O50G1jkmjfNA7lXfOu6oKJMq23zS5wBQ 47RClzVyIk6atELNGHGhbpViVor9AM9SybiM1GibAHXP7klPQniYTsErzhTargC9IPs0 0uf46Wry5ZJcdVZ3MkO7yKim2n6pdw0v8dOQE+u+H7g+EOUhcbxUzXY5EJSe14V2wFIz +naG1BfId8r+tLRy2g59KVnPVR8uApUA47mADceidGaq1B7U9dNAuPaFeGG23+75OuWf SnZ/0RIBU5LRX+INP+Zdi8po5BoGxz5DLEr1F/tdiGHQLTFAmt5EvqTMsVYKqqsHd9UP MF5w== X-Gm-Message-State: AOJu0YzvzxfalIX8yD20NKuN+D/IK9p6d1IDQZpW8NJ800uXroC6sQk6 r5Njs8X6aTdP4uSTG74b9RPdjN0LKmob5P60KvuowHClGrBLyrXPsvFKZJFaet8tMsOLLVE9MVr A/i1AZQYP8FIY74M0rm+N3s80gU24TcY= X-Gm-Gg: ASbGncv+wphDwRzHB0UGRYRyyetU3dZg3xtl0eLsBX9mfETWtoqTPB5P1UXkNFoZGIm GUJUSg+fmsoyxpGFO4I7aZkhmk08vRW5FGZVbOOHYLFfZipos/k4O8a0w+QBL6u0miDNF7STOGb oRdRq+MNFuLPApUh/IUUVGqNBTbhbL5zuy8xGpXfr5LwI= X-Google-Smtp-Source: AGHT+IEn6QN8HnJruxfnbT6/uiVWPHhFnKLEaqTgwVajJXULnvX3bx+rOCa187u3CyRuMAxHr+Qx2RljlfusyP7U0Hc= X-Received: by 2002:a17:907:2da9:b0:ad9:16c8:9ff4 with SMTP id a640c23a62f3a-adfad2773b1mr1808688966b.11.1750309728912; Wed, 18 Jun 2025 22:08:48 -0700 (PDT) MIME-Version: 1.0 References: <50b51d926417c0832e24753903710d0fa3311815.camel@cybertec.at> In-Reply-To: <50b51d926417c0832e24753903710d0fa3311815.camel@cybertec.at> From: Al Grant Date: Thu, 19 Jun 2025 17:08:37 +1200 X-Gm-Features: Ac12FXxkK1S_gbVhOM3LjOuMg2dVjDhxxv0EyA4au5rYBQXyQyeOX5mOkqTYdLc Message-ID: Subject: Re: Postgres DB design Question (High Level) To: Laurenz Albe Cc: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Not sure if it makes a big difference to the answer, but MySQL was a typo - the edge db on the Rpi is Sqlite3. On Thu, Jun 19, 2025 at 5:00=E2=80=AFPM Laurenz Albe wrote: > > 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 --=20 "Beat it punk!" - Clint Eastwood