Doing efficient joins server side, simply js