I’m using PHP and MySQL, and I’m building a database that needs to store urls. I’m going to have to do a lot of work with the parts of the url. It’s going to end up being millions of records.
My question is, what makes more sense:
- to store the parts of the url in several fields, negating the need to
parse - store the whole url in one field, and parse it out every time
Thanks for any advice you can offer!
The rule of thumb when you design new database schema – is not to denormalize until it is proven that it is necessary.
So start with the most normalized and the simplest schema. And only after you experience any performance issues – profile your application and solve the particular bottleneck.