Basic Data Structures
Terminology clarification
Terms have obtained different meanings, depending on context.
| Term |
SQL |
Database implementation |
| Key |
Usually understood to mean primary key. Key is unique. |
The key of a hash table or tree. Key may or may not be unique. |
| Primary key |
Set of columns that uniquely identifies rows. Also, the target
of foreign keys. |
— |
| Index |
Data structure for fast lookup by key |
| Primary index |
— |
Not an option in Postgres. |
| Secondary index |
— |
Neither clustered nor sparse. All indexes in Postgres are secondary. |
|