Question: I have a website with a database of 2,4 million entries. Now I want to use mod\_rewrite to produce clear URLs like example.com/this-is-a-beautiful-url. To recognize which URL belongs to which page I want to build a URL-table which refers to the website's content. Like "this-url-example" belongs to the post with the ID 123. 
Now 2 friends are telling me 2 different ways to build this table and I don't know which one is the best.

1. Advice: "Make a MD5 hash of the URLs and save them in a binary field with an index".
2. Advice: "Simply save the urls in plain text and put an index on it".

Which method would provide faster select-queries? Do you have another advice? Thanks!

Answer: 
MD5 Hash was designed for data comparison purposes. I.e. checking that a password is valid or that a file remains unchanged.

If you plan on being able to change and modify the URL (for search engine optimization purposes) I would stick to Plain text.

Also if you want to create Mod Rewrite Commands (in your HTACCESS) file - it will need to be plain text to enable you to link that URL with a particular page.
I would not use either mysql or md5 hashing. Instead, use a key-value store such as [dbm](https://en.wikipedia.org/wiki/dbm) or [leveldb](http://leveldb.org/). If you are using Apache's `mod_rewrite`, it has a feature, [RewriteMap](http://httpd.apache.org/docs/current/rewrite/rewritemap.html) that can read the keys and values directly from a dbm db, or by calling an external program. The type can be `sdbm`, [`gdbm`](http://www.gnu.org.ua/software/gdbm/), `ndbm` or `db` ([Berkeley DB](https://en.wikipedia.org/wiki/Berkeley_DB)), and apache includes a program, [httxt2dbm](http://httpd.apache.org/docs/current/programs/httxt2dbm.html), to create the database. If you do want to use MySQL, RewriteMap can do that as well with the dbd option, and [mod\_dbd](http://httpd.apache.org/docs/current/mod/mod_dbd.html). Performance-wise, using a hash index on MySQL should be similar to Berkley DB.