The fastest algorithm will depend on the nature of the data. So Postgres maintains statistics, allows indexes, and uses a query optimizer to find an "unterrible" approach. The measure of terribleness is IO.
Or to put it another way, there isn't a silver bullet method based on theory. In practice it is always one of a kind for the job in hand. That's why database tuning is a thing.
Good luck.