Move child.Next() from Open() to Next() for IndexLookUpJoin

child.Next() is called in Open() for IndexLookupJoin.

But I think maybe it’s better to call child.Next() in Next(). Because if child.Next() is called in the open phase, it means that the child’s output must be ready in the open phase. This may not be sufficient in some cases.

it meat to get the first batch of data ASAP, if you find it doesn’t help, I think we can move this operation to Next()

Actually, I’m suspecting whether it would help. Can you construct some benchmarks to show the differences?

OK, we can do some benchmarks to prove it. For now I use a hack way to avoid this problem during the development of CTE. (Let the child to wait on a channel until its output is ready.)

PS: If this benchmarks really works, why HashJoin doesn’t use this optimization.

The network connection between TiDB and TiKV Coprocessor is also done in the open() phase. These optimizations may show improvements when the query is small and not compute-intensive on the TiDB side.