Let $P$ be a polynomial in $n$ variables with rational coefficients,
$P \in {\mathbb Q}[Z_1,Z_2, \ldots ,Z_n]$, and consider the algebraic
set
$Z=\lbrace (z_1,z_2,z_3, \ldots ,z_n) \in {\mathbb Q}^n | \
P(z_1,z_2, \ldots ,z_n)=0 \rbrace$
If $r$ is a nonnegative integer, $x_1,x_2, \ldots ,x_r$ are variables, and $Q_1,Q_2, \ldots ,Q_n$ are polynomials in $x_1,x_2, \ldots ,x_r$ such that $(Q_1(x_1, \ldots ,x_r),Q_2(x_1, \ldots ,x_r),\ldots,Q_n(x_1, \ldots ,x_r)) \in Z$ for all $(x_1, \ldots ,x_r) \in {\mathbb Q}^r$, we call $(Q_1,Q_2, \ldots ,Q_n)$ a $r$-dimensional parametric solution of the equation $P(z_1,z_2, \ldots ,z_n)=0$. It is also natural to define a maximal parametric solution as one with the largest possible $r$ (to avoid trivialties, we also impose that there is no variable upon which none of the $Q_i$ depends. I'm not sure that this last condition avoids all degenerate cases, but I'd like to avoid definitions that involve advanced notions such as the dimension of an algebraic variety ).
My questions : is the problem of computing the largest $r$ known to be undecidable in general ? What are the most general cases in which algebraic geometry allows us to compute the largest $r$ (and the associated parametric solutions) ?