DEV Community

Discussion on: Building a url-shortener. My architecture.

Collapse
 
petrussola profile image
Pere Sola

Great point, Chinedu. I am saving the new random string in the DB table alongside the long URL. If the next request generates the same short string and finds it in the DB when querying it, it will create a new one before returning it to the client. Thoughts?

Collapse
 
nedsoft profile image
Chinedu Orie

Cool, I think that makes sense. You'd probably index the random string column to enhance the performance because for every new record, you'd search for a duplicate random string.