Skip to content

Instantly share code, notes, and snippets.

@xeoncross
Created November 11, 2019 18:20
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 xeoncross/2ca4220a321ec81a514ba634932be8f5 to your computer and use it in GitHub Desktop.
Save xeoncross/2ca4220a321ec81a514ba634932be8f5 to your computer and use it in GitHub Desktop.
Example of writing a MariaDB query to generate 100k records
-- See more at https://stackoverflow.com/a/49446214/99923
INSERT INTO T1 (id, created_on, domain, seen_on)
SELECT one.X, two.X, three.X, two.X
FROM (select seq, seq X from seq_1_to_100000) one
LEFT JOIN (select seq, NOW() - INTERVAL seq MINUTE X from seq_1_to_100000) two ON one.seq = two.seq
LEFT JOIN (select seq, CONCAT(seq,'.',seq) X from seq_1_to_100000) three ON one.seq = three.seq;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment