Imagine we have three tables in a MySQL database:
- posts
- categories
- category_post
There is a one-to-many relationship between posts and categories so that a single post may have many categories.
The category_post table is the pivot table between categories and posts and has the following columns:
- id (primary key, auto-incrementing, big integer)
- category_id
- post_id
Let's also imagine that we have 1,000,000 rows in our category_post table.
My question is:
Is there any performance benefit to having the id column in the category_post table or does it just take up extra space?