Skip to content

Instantly share code, notes, and snippets.

@tobyhede
Created June 25, 2016 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobyhede/2e8e14cdfa978f553568a6042cd5b2c9 to your computer and use it in GitHub Desktop.
Save tobyhede/2e8e14cdfa978f553568a6042cd5b2c9 to your computer and use it in GitHub Desktop.
Easily generate timeseries data in PostgreSQL
CREATE TABLE tseries AS
SELECT ts, (random()*9999)::int as count from generate_series(
'2015-01-01'::timestamptz,
'2016-06-01'::timestamptz,
'1 sec'::interval
) date;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment