Home › Forums › Other › How to setup a database table? › Re: How to setup a database table?
Just as extra food for thought –
Is every URL you store going to be unique? If not, then will every URL+title combination be unique?
What I’m getting at is that, while every table should have an index, that index doesn’t _need_ to be artificial. “Natural” indexes are preferable, in fact, while also bringing the performance benefits @CrocoDillon mentioned.
**If** every URL+title combination will be unique, do
`PRIMARY KEY( url,title )`
and drop the `id` column.
You _might_ want to index the `title` column (separately) also, if you ever plan on searching by title without the URL.
Otherwise, **if** every URL will be unique, do
`PRIMARY KEY( url )`
and drop the `id` column.
You _might_ want to index the `title` column also, if you ever plan on searching by title.
Otherwise, keep your `id` column as the PK.