I utilize the index when merging. This is great because it reduces the O(n^2) merge operation to O(n), however we can't guarantee the column we wish to merge on is always indexed. Consider the following:
const students = Array.load(...).index("language");
const teachers = Array.load(...).index("age");
students.merge(teachers, "language");
The students collection is indexed on the language field, but the teachers collection is not. Therefore this will fail to find matching teachers for each student.
Instead of this, we should:
Fall back to the O(n^2) solution
Throw a warning that the column is not indexed and therefore the operation was much slower than it could be
I utilize the index when merging. This is great because it reduces the
O(n^2)
merge operation toO(n)
, however we can't guarantee the column we wish to merge on is always indexed. Consider the following:The students collection is indexed on the
language
field, but the teachers collection is not. Therefore this will fail to find matching teachers for each student.Instead of this, we should:
O(n^2)
solution