The primary key for a table represents the column or set of columns that you use in your most vital queries.
表的主键表示在最重要的查询中使用的列或列集。
It has an associated index, for fast query performance. Query performance benefits from the NOT NULL
optimization, because it cannot include any NULL
values.
它有一个相关的索引,用于快速查询性能。查询性能受益于NOT NULL优化,因为它不能包含任何NULL值。
With the InnoDB
storage engine, the table data is physically organized to do ultra-fast lookups and sorts based on the primary key column or columns.
在InnoDB存储引擎中,表数据被物理地组织起来,以执行基于主键列的超快查找和排序。
If your table is big and important, but does not have an obvious column or set of columns to use as a primary key, you might create a separate column with auto-increment values to use as the primary key.
如果表很大而且很重要,但是没有一个明显的列或一组列可以用作主键,那么可以创建一个单独的列,使用自动递增值作为主键。
These unique IDs can serve as pointers to corresponding rows in other tables when you join tables using foreign keys.
当您使用外键连接表时,这些惟一id可以作为指向其他表中相应行的指针。