Random Data

Learn to generate random data in PostgreSQL.

Generating random data is useful for various purposes, but more often than not, we want to generate random data for testing, development, and benchmarking. For example, you might want to populate data in your local development environment, or you might want to test some query optimization techniques and you need a big table.

The RANDOM function

To generate random numbers PostgreSQL provides a random function. The function then returns a value between 0 and 1:

Access this course and 1400+ top-rated courses and projects.