Good day. I am now trying to create a blog from scratch for educational purposes - just to understand the internal mechanics of such web applications. I am trying to plan the database, but since I am a noob in this area, questions arise.
Here is one of them:
I want to make posts can be tagged with text tags, which then filter. For each post can be a list of several tags, how many exactly - is unknown. The list of tags is not predefined; it should be possible to create an entry with tags that have not been previously used. But at the same time I want to be able to quickly get a list of all tags existing in the blog at the moment.
How it is more correct to make in a DB?
Only one thing comes to my mind: to make one field where to enter the list of tags through a certain separator.
But I have doubts: how effective is this approach in terms of search speed?
And how to get a list of all existing tags from it? Can this be done immediately with some tricky query? Or do you need to receive this field for all records, transfer it to the server script, which will already cut the lines by separator, and make a list, catching repetitions? And how effective will it be?
It is clear that in the framework of my training example, this will all work quite quickly, since the number of records is scanty. But how to solve such a problem correctly on real blogging services with a large number of users?