Posts and categories are probably many-to-many, not one-to-many.
A many-to-many relationship table is best done, for example,
CREATE TABLE a_b ( a_id ... NOT NULL, b_id ... NOT NULL, PRIMARY KEY (a_id, b_id), INDEX(b_id, a_id)
In this case, you automatically get a "cluster" search in both directions and avoid unnecessary artificial identifier for the table.
(By the way, NB, implicit PK - 6 bytes, not 8. The topic has a long post by Jeremy Cole.)
One-to-many relationships do not need an extra table. Instead, one identifier is inside another table. For example, the City table will have an identifier for the country in it.
source share