Alex's Slip-box

These are my org-mode notes in sort of Zettelkasten style

Create temp table with tons of records

This might be useful for doing some rudimentary performance testing.

See also Large SQL data migrations

# Postgres

This example generates a temp table called things, with 1 million rows.

\timing

CREATE SCHEMA IF NOT EXISTS temp;

CREATE TABLE temp.things AS
SELECT
  seq AS id,
  'Name-' || seq::TEXT as name
FROM GENERATE_SERIES(1, 1000000) AS t(seq);

# MSSQL

I’m not sure how best to do this with MSSQL, but one option is a loop, but it takes a long time (hours) if you need millions of records. See also https://www.mssqltips.com/sqlservertip/5148/populate-large-tables-with-random-data-for-sql-server-performance-testing/

Search Results