What distinguishes English from most other languages is its use of commas before a dependent (subordinate) clause. Dependent clauses (clauses introduced by words like “that”, “which”, “who”, “where”, “how”, etc.) are usually neither preceded nor followed by a comma. For example:
Dependent clauses are (and in fact must be) separated with commas only when the information contained in the clause is not important for the overall meaning of the whole sentence. A good way to recognize such clauses is to try to enclose the clause in parentheses; if the sentence still makes sense, you should use commas (or parentheses) to separate the clause from the rest, e.g.
Commas were appropriate here because we could replace them with parentheses:
Not using commas or parentheses would be a mistake in this case. The sentence
implies that only Brazil nuts sold in a supermarket (and not elsewhere) are a great source of selenium, which is certainly not the case.
Notice how the three examples we used at the beginning wouldn’t make sense if we put the dependent clause in parentheses:
Going back to the title of this article—“that” can be used only in clauses containing essential information; it is not correct to write:
In other words, there is virtually never a comma before “that”, unless there is some other reason to use a comma, such as another non-essential subordinate clause ending there.
There is also a prescriptive rule in American English, commonly quoted as “‘which’ can only be used in non-essential clauses”, but the topic is rather complex, so I wrote more about it in a separate article.