In some cases, you might notice your query activities failing because of time-outs.
This occurs because, by default, query activities in Salesforce Marketing Cloud time out after 30 minutes as explained in the article below:
Optimize the Query Activity
You can try rerunning the selection and it might succeed, but this will not always be the case.
A more efficient way to avoid this problem is to try to optimize your selections. To do so, it is recommended to use primary keys to join your tables and in the fields used in the data extension in (Not) In Results filters.
In case that is still not enough, other possible solutions would be to either contact Salesforce to increase the time out limit or split your selection in smaller simpler ones.