Skip to content

Instantly share code, notes, and snippets.

@djk447
djk447 / Implementing an Array-Based Timeseries Store in Postgres Part 2.md
Last active November 8, 2016 22:06
Timeseries are problematical in Postgres, here's part 2 of an attempt to make them a little less so.

#Implementing an Array-Based Timeseries Store in Postgres Part 2 See Part 1 here for an explanation of what we're up to. In this bit, I'll be taking this to a larger data store and seeing how the results scale. ##Data Setup and Recap of Part 1 The data is the same as from Part 1, except that we're now using a much larger data set. And we're only using the test2 table that I defined earlier. For a referesher, here's the original schema:

CREATE SCHEMA data;
CREATE TABLE data.generators (
    id          varchar primary key,
    ptid        int NOT NULL UNIQUE,
@djk447
djk447 / Implementing an Array-Based Timeseries Store in Postgres.md
Last active October 26, 2022 16:42
Implementing an Array-Based Timeseries Store in Postgres

#Implementing an Array-Based Timeseries Store in Postgres

UPDATE: This is Part 1, Part 2 is here, enjoy!

In response to Jim Nasby's question over at ElephantStack I thought I'd play around with the concept and see where it took me. Hoping to spark ideas from others on how to store things that have a column and row element more effectively with Postgres. ##Data Setup The data I’m using for this example is publicly available data from the NYISO historical data set located here: http://www.nyiso.com/public/markets_operations/market_data/custom_report/index.jsp?report=rt_lbmp_gen

It’s the real time location based marginal price of electricity at multiple generators in New York State. The tables I’ve used to store data from the NYISO site are below (I probably ought be using text instea