Q1: No. I do not see the point of the tags table. It doesn't seem to mean anything. If you cannot explain the semantic meaning of the row in this table (what does the entry in this table do in the real world?), Then it probably does not belong. I suspect that it is only there to give you auto_increment , which will not be a good answer. You can assign your own identifiers.
Q2: already answered.
I also donβt see what tag_translation_id and tag_relationship_id . Normal use of auto_increment ?
I think I would do for a basic structure:
create table tag_translations ( tag_id int not null, language_id int not null, tag_name varchar(255), primary key (tag_id, language_id) ); create table tag_relations ( tag_id int not null, solution_id int not null, primary key (tag_id, solution_id) );
To which I would add metadata and indexes as needed. Two column indexes are very good for joins, such as tag_relations ' Using index optimization:
Index usage
Information about a column from the table was obtained using only the information in the index tree without the need to make an additional attempt to read the actual series. This strategy can be used when the query uses only columns that are part of the same index.
Btw, for internationalized systems, 255 is not a magic number for the varchar field length unless you adhere to single-byte encodings. If you are using UTF-8, take a look at the manual and think about it, especially if you are going to index this column.
user213154
source share