O
O
Oleg Petrov2018-10-20 20:06:50
PostgreSQL
Oleg Petrov, 2018-10-20 20:06:50

How to create a table with a time series?

There is a weather forecast table.
100 cities and each has its own forecast for tomorrow, its own humidity and pressure
Everything is clear. The columns are City, temperature, humidity, pressure, date and fill in all cities in them.
But tomorrow we will have all new values ​​for each city. Where to fill them out? All in the same columns but with a different date? Is it right to do so?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xSkyFoXx, 2018-10-20
@Smeilz1

The format you suggested is called fully denormalized. 100 records for every day is
a mere trifle for any popular database. Even if you are going to store data for 1000 years.
If you want to make access very, very fast, and your selection most often occurs by city and date, you can add a secondary key either to both fields, or only to the date.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question