1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Best way to select random rows PostgreSQL

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 17, 2024 às 17:53.

  1. Stack

    Stack Membro Participativo

    I want a random selection of rows in PostgreSQL, I tried this:

    select * from table where random() < 0.01;


    But some other recommend this:

    select * from table order by random() limit 1000;


    I have a very large table with 500 Million rows, I want it to be fast.

    Which approach is better? What are the differences? What is the best way to select random rows?

    Continue reading...

Compartilhe esta Página