A primary key is an attribute or set of attributes that uniquely identifies a row in a table. But a primary key has not only to be unique, but also minimal. Why is that necessary?
Primary keys should be minimal since they only have to be large enough to uniquely identify the row. Anything else is a waste in terms on index space used.
In other words, if I have a unique column username
along with another unique column student_id
, a primary key built from both of those is a waste. The normal way to handle that would be to use one as the primary key and then have a unique constraint/index on the other.
The reason why it's important to identify minimal keys is to ensure that there is no redundancy in dependencies on those keys. Redundancy can cause anomalies and incorrect results.
Minimality is essentially a semantic matter rather than purely a structural feature so it isn't necessarily required by the database implementation. For instance SQL allows you to create a "PRIMARY KEY" on any superkey, which may not be an irreducible superkey.
Minimality has nothing to do with storage size because minimal means irreducible, it does not mean smallest.