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 1uS7Er-003Yia-57 for pgsql-general@arkaria.postgresql.org; Thu, 19 Jun 2025 04:51:01 +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 1uS7Ep-007Yoo-5t for pgsql-general@arkaria.postgresql.org; Thu, 19 Jun 2025 04:50:59 +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 1uS7Eo-007Yog-R7 for pgsql-general@lists.postgresql.org; Thu, 19 Jun 2025 04:50:59 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uS7En-002sez-0A for pgsql-general@lists.postgresql.org; Thu, 19 Jun 2025 04:50:58 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-606ddbda275so629786a12.1 for ; Wed, 18 Jun 2025 21:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750308654; x=1750913454; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=260Qb6X5EdxdjsUnaeUQzpP5dbHWj2uPtnim7FA1+hA=; b=bUp5R2tBNAV6VIAqIXS/Ggn5ESvjAPo7Zyv8LKmZAOiss+z2aU7uSbQEVWvvZjzbkT hmhics3mz2Y4sN4x7PqZr3XeZxCoF7RiInyML9Oe/45aTWnRU00cerZ4jF3lUjNtrp0Z fsKUcWYKSQMlnPvaxHzUuX4KZ0eqW9CRjR4NhjLplz5PBf0sqSzO8IzwgwXgw3FLwS49 56IXfwI4I0lSwPkyTTJwRlaHGlsG5Rvlx46F7ZmcPWUqIlZxF/mz89PXmSwUuTUq1lzC dEzKxvvg04Gf6mVq7DJk1/07DtGELd02Sgg+9qPWaIa1VUR+PZ339oUpr3dBh2sfXw5Z dN8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750308654; x=1750913454; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=260Qb6X5EdxdjsUnaeUQzpP5dbHWj2uPtnim7FA1+hA=; b=q/YKNZSgROLqwOGLMHVoSsg5NdgBXxnxAnttviEz9AJaGVD0A2KzISWEMPoGLKWEjp zGnMOvlTZoKwpqjN5jyfj38Uxt0oaQ43ZsFhdwclllHSYvV0A/VJPDSvZY+ZuBxpK17S ww/7zswM4SjMopuGmzh9q/MaPtw76Xj3kJ48MzCQ66ywWrdXGg/dz3tAAarYSBzWFgg6 xaLPAFAayvl+Fcy2mfIiBv56skQw77eFNh5Jdj+nhvo6NSzTqlfM9KJ6QWt8QOwFrDSp Ii58GXemyPMaKALxYRBnBShdtER09HEb2SCbzGSOryVMx6aGYp6f1EXuMKyFl/VYuNbm 1hJQ== X-Gm-Message-State: AOJu0YwGXnxGt04NNY0T0X7YicavTy+qrnHZ5hatIp+yJK20soF/+h5S xylvGlLwCYvKhOd/Wt+1Z33CCprV2HhvbcyPy5wiZUyRbgeXo9jefT9YOXhIntCzE//P+6zFmY1 SziCNOX3A/pDum5DUWNi6xZMqoLNHZQKCN3Cl X-Gm-Gg: ASbGncsEVgx/s4YWewU7txjOPX1qH2E0L2YI+aNblCZtbpKYYC528vbe7FUSMynNXro 6ocHRX3AlMA6ypZfgx3nCjeKnzfn1+w3zqWlBygLb/DIbltqM8EAmPxLab30BqYWRnFVfJOON5K C4ZC3+sUS+UQHXLcYcB04BA545ZIH5TyRr3LT1Pj2+4qA= X-Google-Smtp-Source: AGHT+IEzY0sJ8wfrhzfJZY9Kv+euAaU8n/DkoFyDnOvTFw63tZuEjhvlAD4JvNXk1wCpDMuobGgIwPbhHjLE1O9yKaU= X-Received: by 2002:a17:907:3d88:b0:adb:229a:f8bd with SMTP id a640c23a62f3a-adfad40c25bmr2069007366b.29.1750308654184; Wed, 18 Jun 2025 21:50:54 -0700 (PDT) MIME-Version: 1.0 From: Al Grant Date: Thu, 19 Jun 2025 16:50:42 +1200 X-Gm-Features: Ac12FXzZ74_jueI_lHyotFSgBzMqXiWEWIQFzgSeOajPs8UqSQ11jpfBVtzWnSU Message-ID: Subject: Postgres DB design Question (High Level) To: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Introduction: I have a question about the design of a project as it relates to databases, and the scale-ability of the design. The project is volunteer, so there is no commercial interest. But first a bit of background: Background: I have programmed a rasp pi to record radio beeps from wildlife trackers, where the beep rate per minute (bpm) can be either 80, 40, or 30. The rate can only change once every 24 hours. The beeps are transmitted on up to 100 channels and the animals go in an out of range on a given day. This data is written to a Sqlite3 db on the Rpi. Since the beep rate will not change in a given 24 hour period, and since the rasp pi runs on a solar/battery setup it wakes up for 2 hours every day to record the radio signals and shuts down, so for a given 24 hour period I only get 2 hours of data (anywhere between about 5-15,000 beeps depending on beep rate and assuming the animal stays within range). The rpi Sqlite3 DB is sync'd over cellular to a postgresql database on my server at the end of each days 2 hour recording period. Since I am processing radio signals there is always the chance of random interference being decoded as a valid beep. To avoid a small amount of interference being detected as a valid signal, I check for quantity of valid beeps within a given 1 hour window - so for example if the beep rate is 80 it checks that there are 50% of the maximum beep rate detected (ie 80*60*0.5) - if there is only a handful of beeps it is discarded. Database design: The BPM table is very simple: Id Bpm_rate Integer dt DateTime 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? 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). Thanks in advance for any input. Al