is the key we use in phpmyadmin is a primary key or a surrogate key?

51 Views Asked by At

What's the difference between a primary key and surrogate key if both are unique keys. The primary key acts same as a surrogate key in phpmyadmin. I have heard in a video that a surrogate key is independent of the other columns of the table. Also what it has to do with the fact table and dimension table.

1

There are 1 best solutions below

0
NickW On

A surrogate key is a primary key that is created within the data load process of a data warehouse. There are a number of reasons for using a surrogate key rather than the primary key from a source system; these include:

  • SKs are normally integers and tend to perform better in joins than the long(er) alphanumerics that PKs may consist of
  • if you load the same target from multiple sources then you can't guarantee that a PK from one source system is unique across all source systems
  • if you are creating SCD2 records for a dimension then you would have multiple records per PK i.e. the PK would not uniquely identify a record