Posted on 2nd March 2024
Order by random() used for testing purposes where you need random data then we go with this Order by random() functionality.
PostgreSQL fetches all the columns from the mentioned table and then selects a random row. Therefore, this is quite helpful and fast for small tables but large tables like tables having 750 million columns. It takes a few minutes, which is a drawback for this functionality.
SELECT column FROM table
ORDER BY RANDOM ()
STILL GOT QUERIES?