Database vs text file for url shortener

Hello!
I’m wokring on a short URL script. I’ll store the shortened URLs in either a text file or MySQL database, which of those two alternatives do you think would be most effective and result in the fastest redirects and lowest system load?

Regards
Oskar

Usually short URLs are going to redirect somewhere else. In general, unless you are creating a URL shortening service like bit.ly, then performance is going to be a non-issue.

Use SQLite instead. A MySQL database would be a little too heavy for such a simple need, and flat-text files are too inefficient.

Thanks for your replies! I already have MySQL in use for other websites on the same server so I guess it’ll be storing the data in a database then :slight_smile: