Re:How to create a 1M record table with a single query
by DasIch on Wednesday March 24, 2021 @05:25AM
(#26565089)
You want to run a transaction in production and you're unsure about the impact because it might take a lock and block other transactions for some time. In that case you may want to spin up a separate database with fake data and test it there first.
You could create a new database and restore a production backup instead of using fake data but that might not be allowed or require some kind of approval due to rules protecting the privacy of customers or employees.
Re:How to create a 1M record table with a single query
by dspillett on Wednesday March 24, 2021 @06:57AM
(#26565623)
Generating test data batches like this is a common use.
The other is for populating "numbers tables" which can be very useful in reporting contexts and/or dealing with certain gaps/islands type problems.
You can even use the techniques dynamically rather than a stored numbers table, if you need it in a DB that doesn't have one and you don't have schema permissions to create one, though this is generally less efficient.
Re:How to create a 1M record table with a single query
by psing on Wednesday March 24, 2021 @09:29AM
(#26566904)
Creating realistic fake data is useful in lower environments and for load testing. Outside of SQL I like faker: https://github.com/joke2k/faker
Re:How to create a 1M record table with a single query
by unnouinceput on Wednesday March 24, 2021 @04:27AM
(#26564756)
Exactly like that, yes.
E.g. I have a table structure but not alot of rows in it, so i go use this to get alot of rows in to check how fast queries get processed?