How to create (lots!) of sample time-series data with PostgreSQL generate_series()

Exploring new features in PostgreSQL or reproducing an unusual query plan can be tricky without representative data to utilize. While there are a plethora of sources for sample data and tools to import it, you can end up spending too much time finding representative data to work with.

Although using real application data would be ideal, PostgreSQL provides the generate_series() function which makes it easy to create a representative time-series dataset using varying cardinalities and different lengths of time.

In this talk we'll introduce generate_series() and demonstrate how to use it to create realistic-looking time-series data of all shapes and sizes, using custom PostgreSQL user defined functions. Once we've mastered the basics, we'll dial it up a notch by incorporating PostgreSQL math functions and relational data to create realistic time-series patterns of data for various use cases like sales or web site visits.

Ryan Booz

Developer Advocate at Redgate

State College, Pennsylvania, United States


Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top