Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 309221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:43:19+00:00 2026-05-12T07:43:19+00:00

Problem: A relational database (Postgres) storing timeseries data of various measurement values. Each measurement

  • 0

Problem:

A relational database (Postgres) storing timeseries data of various measurement values. Each measurement value can have a specific “measurement type” (e.g. temperature, dissolved oxygen, etc) and can have specific “measurement units” (e.g. Fahrenheit/Celsius/Kelvin, percent/milligrams per liter, etc).

Question:

Has anyone built a similar database such that dimensional integrity is conserved? Have any suggestions?

I’m considering building a measurement_type and a measurement_unit table, both of these would have text two columns, ID and text. Then I would create foreign keys to these tables in the measured_value table. Text worries me somewhat because there’s the possibility for non-unique duplicates (e.g. ‘ug/l’ vs ‘µg/l’ for micrograms per liter).

The purpose of this would be so that I can both convert and verify units on queries, or via programming externally. Ideally, I would have the ability later to include strict dimensional analysis (e.g. linking µg/l to the value ‘M/V’ (mass divided by volume)).

Is there a more elegant way to accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:43:19+00:00Added an answer on May 12, 2026 at 7:43 am

    I produced a database sub-schema for handling units an aeon ago (okay, I exaggerate slightly; it was about 20 years ago, though). Fortunately, it only had to deal with simple mass, length, time dimensions – not temperature, or electric current, or luminosity, etc. Rather less simple was the currency side of the game – there were a myriad different ways of converting between one currency and another depending on date, currency, and period over which conversion rate was valid. That was handled separately from the physical units.

    Fundamentally, I created a table ‘measures’ with an ‘id’ column, a name for the unit, an abbreviation, and a set of dimension exponents – one each for mass, length, time. This gets populated with names such as ‘volume’ (length = 3, mass = 0, time = 0), ‘density’ (length = 3, mass = -1, time = 0) – and the like.

    There was a second table of units, which identified a measure and then the actual units used by a particular measurement. For example, there were barrels, and cubic metres, and all sorts of other units of relevance.

    There was a third table that defined conversion factors between specific units. This consisted of two units and the multiplicative conversion factor that converted unit 1 to unit 2. The biggest problem here was the dynamic range of the conversion factors. If the conversion from U1 to U2 is 1.234E+10, then the inverse is a rather small number (8.103727714749e-11).

    The comment from S.Lott about temperatures is interesting – we didn’t have to deal with those. A stored procedure would have addressed that – though integrating one stored procedure into the system might have been tricky.

    The scheme I described allowed most conversions to be described once (including hypothetical units such as furlongs per fortnight, or less hypothetical but equally obscure ones – outside the USA – like acre-feet), and the conversions could be validated (for example, both units in the conversion factor table had to have the same measure). It could be extended to handle most of the other units – though the dimensionless units such as angles (or solid angles) present some interesting problems. There was supporting code that would handle arbitrary conversions – or generate an error when the conversion could not be supported. One reason for this system was that the various international affiliate companies would report their data in their locally convenient units, but the HQ system had to accept the original data and yet present the resulting aggregated data in units that suited the managers – where different managers each had their own idea (based on their national background and length of duty in the HQ) about the best units for their reports.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 211k
  • Answers 211k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes this is possible. See this blog entry for a… May 12, 2026 at 10:04 pm
  • Editorial Team
    Editorial Team added an answer Get this exact same issue under the same conditions Snow… May 12, 2026 at 10:04 pm
  • Editorial Team
    Editorial Team added an answer This had to do with how my links were setup.… May 12, 2026 at 10:04 pm

Related Questions

I'm using a hand built (Postgres) database with Django. With inspectdb I was able
In a classic relational database, I have the following table: CREATE TABLE Person( Id
Some time ago I thought an new statistics system over, for our multi-million user
I'm using Delphi to create an XML document from data in a relational database.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.