Is
\midequivalent to\, | \,?
I am asking this because, \mid does not cooperate with \big. However \,\big| \, works fine. I typically use these expressions when defining sets, for instance:

Is
\midequivalent to\, | \,?
I am asking this because, \mid does not cooperate with \big. However \,\big| \, works fine. I typically use these expressions when defining sets, for instance:

They're not equivalent. The space around \mid is \thickmuskip, which is normally twice as big as \thinmuskip (which is what's inserted by \,).
If you want a bigger bar as a relation symbol, use
\Bigm|
(the m stands for “middle” and, by convention, this yields a relation symbol).
If you're on LaTeX, don't use $$. You should also use \Bigl for left delimiters and \Bigr for right delimiters.
Let's compare the results:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather}
\Bigl\{ \sum_{k=1}^n k \,\Big|\, n\leq 5 \Bigr\} \\
\Bigl\{ \sum_{k=1}^n k \Bigm| n\leq 5 \Bigr\} \\
\Bigl\{\, \sum_{k=1}^n k \Bigm| n\leq 5 \Bigr\}
\end{gather}
\end{document}
In the last one I added a thin space to avoid a clash by moving the brace slightly farther than the summation.
\Bigm|. – egreg Oct 08 '19 at 13:32\Setexample in themathtoolsmanual (I'm not personally a fan of using\midfor sets as it cannot be scaled, thus confusing syntax) – daleif Oct 08 '19 at 13:51