Is it faster to fetch rows by ID (primary key) or by other fields like title?
Hello fellow hashnoders! I'm a Laravel developer and was wondering If i have a table of posts in a MySQL DB: Is it faster to fetch rows by ID (primary key) or by other fields like title?
Just to clarify.. if you make another column as unsigned integer and set it to unique. That must in theory be as fast as your primary ID, but in fact, it is a primary or secondary ID
Emil Moe
Senior Data Engineer
Yes it is.
Primary Key is indexed, you can achieve this too by index another column, but integer columns are faster to search hence their size is smaller.