9. If $P(x, y)$ is a point on the hyperbola $\frac{x^{2}}{8}-\frac{y^{2}}{4}=1$, then the minimum value of $|x-y|$ is . $\qquad$
9. 2 .

From the condition, we know that $x^{2}-2 y^{2}-8=0$.
By symmetry, without loss of generality, assume
$$
\begin{array}{l}
x>0, y>0, u=x-y>0 . \\
\text { Then }(y+u)^{2}-2 y^{2}-8=0 \\
\Rightarrow y^{2}-2 u y-u^{2}+8=0 \\
\Rightarrow \Delta=(2 u)^{2}-4\left(-u^{2}+8\right) \geqslant 0 \\
\Rightarrow u \geqslant 2 .
\end{array}
$$

When $x=4, y=2$, the equality holds.
Therefore, the minimum value of $|x-y|$ is 2.