When we open a video on YouTube, we see that some random characters in the URL such as https://www.youtube.com/watch?v=cpp69ghR1IM
.
Is there an algorithm for this job or it just creates random string and checks if its in the database or not? Since YouTube has huge amount of videos, wouldn't be so waste of time to check uniqueness of this generated random string?
Also, why YouTube doesnt use better slugs which generated by video title? For example: https://www.youtube.com/watch/Some-Dummy-Video-Title
Thanks in advance.