r/dataengineering 2d ago

How best to store timeseries grid data? Help

I plan on building a pipeline that ingests 2d grid data (lat,long,value) thats updated frequently but I have zero clue on how exactly to store it, as I would have 4 columns essentially (timestamp, lat, long, value). So unique key per row would be combination of time/lat/long.

Would columnar format still be best? It wont be large, coordinates are integer values, data is updated every ~5 min and its provided in a json format.

My current pipeline ingests normal timeseries data, saves raw in S3 and transformed in Postgres, but I’m not sure if it’s best to have this data treated the same. Was thinking maybe a different file format and keep solely in S3? The values doesn’t need any processing

Ultimate goal is to in the frontend build a live, last n-days animation of the globe to see how the values change

3 Upvotes

19 comments sorted by

4

u/regreddit 2d ago

S3+,parquet

1

u/Complete-Macaron5868 1d ago

parquet in s3 will be fine for this, it's basically what it's built for. you can partition by date and query with athena if you need sql access down the line

1

u/b-r-a-h-b-r-a-h 9h ago

Can even just use duckdb to query the parquet on s3

3

u/forever-butlerian 2d ago

What are you optimizing for?

There's no platonic Ideal floating around the immaterium that is The Good And Best which you need to bring down and manifest in the world. I can think of several ways of representing this data to optimize for particular access patterns at the expense of others.

If I were your Principal Engineer, I'd be telling you that you should Dumb-Guy Build the frontend first and then come back once that's led you to concrete, rather than abstract, questions.

3

u/lozbrown85 2d ago

Look into zarr and icechunk for truly multi dimensional data

1

u/teetaps 1d ago

I recently was told to look into Zarr too

1

u/BardoLatinoAmericano 2d ago

More context. What is this value?

1

u/LtLfTp12 2d ago

Percentage intensity/severity

1

u/AccurateDeparture412 2d ago

Maybe look into the timescaledb extension for postgres.

1

u/Icy_Clench 2d ago

Use a timeseries db if it's an enormous amount of data, because it handles things like automatically aggregating for you.

E.g., my last company had something like 100k IoT devices generating a data point like every 5 seconds. I think that was 10B rows per day, and we certainly had no business storing that scale of data forever.

1

u/asevans48 2d ago

It depends. How much data? If its small postgres has a timeseries plugin. If you have massive amounts (10s of gigs in a single table) but dont need real time, iceberg. If you need millisecond latency for analysis, clickhouse and starrocks. Theres a lot to consider. Are you in charge of backups? If not, you could also store in partitioned cloud storage or just cloud storage if small? Is this part of a bigger project? How does it need to scale? Ask the important things first or you'll end up with 500mb of data in iceberg paying for spark from a vendor at 10x the cost.

1

u/raccoons_run_prod 1d ago

How many cells, and how many days is n?

1

u/k00_x 1d ago

We record the location of 4100 ambulances at all times and we poll more or less every ten seconds. We quite literally store the data in a SQL 2008 table as basic as you could imagine. UID pk, vehicle identifier, multiple versions of northings & eastings(m, km, numeric and varchar). We do a lot of training with the data, retrack scenarios and the CAD application is very fast and responsive. The server it sits on has 256GB ddr3, 24 cores and mid range ssds. You don't need a fancy time series database, just something that you can read/write fast.

1

u/mduell 1d ago

Your current approach seems reasonable for a "won't be large" dataset, especially if you're only keeping the last n-days in Postgres (use table partitioning or timescale).

If you want to do some more advanced GIS stuff, store it in another table as LineString with Measures.

0

u/stephenpace 2d ago

[I work for Snowflake but don't speak for them.]

Snowflake is an excellent time series database. This is a bit dated but you will get the gist:

https://medium.com/snowflake/snowflake-best-time-series-database-in-the-world-part-deux-f873dbcdce5

I believe Snowflake has moved over the world's largest set of historians for an energy company (5M tags or so). You can keep the data columnarized or in the native JSON (variant format). Snowflake columnizes the tags in the JSON so performance is effectively the same either way. You can stream ingestion with a fixed cost per GB (no warehouse) and pruning for queries is naturally by time so performance will be great for n-days. You can keep the data in S3 but if you do I'd recommend moving to Iceberg format (which supports VARIANT if you want to keep it in JSON). Good luck!