Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORDER BY RAND() 쓰는 이유 #260

Open
young-do opened this issue Dec 19, 2019 · 0 comments
Open

ORDER BY RAND() 쓰는 이유 #260

young-do opened this issue Dec 19, 2019 · 0 comments

Comments

@young-do
Copy link
Collaborator

young-do commented Dec 19, 2019

https://stackoverflow.com/questions/4329396/mysql-select-10-random-rows-from-600k-rows-fast
위 링크를 통해 ORDER BY RAND()를 대치할 수 있으나, 다음과 같은 이유로 대치하지 않는다.

  1. Query 문이 너무 길어진다. 이에 비해 ORDER BY RAND()는 매우 짧다.

  2. 여러 개를 가져오는 경우, 정렬되어 반환되므로 이를 다시 서버에서 섞어줘야 한다.

  3. 각 테이블의 행이 100개 미만이다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant