Skip to content

Instantly share code, notes, and snippets.

@omerucel
Created February 23, 2017 07:53
Show Gist options
  • Save omerucel/89dcdbfedef3f4b40489476b5206a975 to your computer and use it in GitHub Desktop.
Save omerucel/89dcdbfedef3f4b40489476b5206a975 to your computer and use it in GitHub Desktop.
Generate test data
INSERT INTO test_table (service_id, event_type, creation_date)
SELECT
generate_series(7070001, 7070010) AS service_id,
('{clicked,pageview,failed}'::text[])[ceil(random()*3)] AS event_type,
timestamp '2016-01-10 20:00:00' + random() * (timestamp '2017-02-21 20:00:00' - timestamp '2016-01-10 10:00:00') AS creation_date
FROM generate_series(1, 10000000) AS X;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment