You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In TiDB if a cte is used more than 1 time in query, it will generate a cte shared scan executor, so the cte itself will only be calulated once, and each reader read the result from cte shared scan.
Currently, TiDB convert cte shared scan into exchange sender/receiver in MPP mode, but exchange sender/receiver actually require that all the exchange reciver read data from the same exchange sender at the same time, and cte reader actually does not meet this requirement.
For example:
with cte as xxx
select * from cte a join cte b where a.id = b.id
In the above query, both build and probe side read from the same cte, but probe side will begin to read afte build side is done, which mean build side will read all the data from cte, after that probe side begin to read. If we change cte shared scan into exchange sender with 2 exchange receivers, the exchange sender expect 2 exchange receiver read data at the same time, if only 1 exchange receiver read data, the exchange sender will be blocked by the other exchange reciever, which will makes the query hangs forever.
So we need to redesign TiFlash support of cte shared read.
The text was updated successfully, but these errors were encountered:
Enhancement
In TiDB if a cte is used more than 1 time in query, it will generate a cte shared scan executor, so the cte itself will only be calulated once, and each reader read the result from cte shared scan.
Currently, TiDB convert cte shared scan into exchange sender/receiver in MPP mode, but exchange sender/receiver actually require that all the exchange reciver read data from the same exchange sender at the same time, and cte reader actually does not meet this requirement.
For example:
In the above query, both build and probe side read from the same cte, but probe side will begin to read afte build side is done, which mean build side will read all the data from cte, after that probe side begin to read. If we change cte shared scan into exchange sender with 2 exchange receivers, the exchange sender expect 2 exchange receiver read data at the same time, if only 1 exchange receiver read data, the exchange sender will be blocked by the other exchange reciever, which will makes the query hangs forever.
So we need to redesign TiFlash support of cte shared read.
The text was updated successfully, but these errors were encountered: