What is the advantage of searching using key by?

The primary advantage of using keys is that the sorting is based on a binary search. This means that, instead of scanning the entire column, it is possible to complete the search in log-time, which can be extremely powerful in practice. It is also very memory efficient, hence improving the overall performance of the query from a systems or resource needs standpoint.

Get Hands-On Data Science with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.