Minimize $q\mapsto\int\frac{(pf)^2}q\:{\rm d}\lambda$ subject to $\int q\:{\rm }\lambda=1$ using the method of Lagrange multipliers
Counter-example
Here is a counter-example to show the solution will not necessarily be proportional to $|p(x)f(x)|$ over all $x \in E$, and the problem can have degenerate cases:
Define:
$E=[0,1]$ with the usual Lebesgue measure.
$p(x) = 1, f(x)=x$ for all $x \in [0,1]$.
For each $d \in (0,1]$ define
$$q_d(x) = \left\{ \begin{array}{ll} \frac{2x}{d^2} &\mbox{ if $x\in [0,d]$} \\ 0 & \mbox{ otherwise} \end{array} \right.$$ Then $\int_0^1 q_d(x)dx = 1$ for all $d \in (0,1]$ and $$ \int_{x:q(x)>0} \frac{(p(x)f(x))^2}{q(x)}dx = \frac{d^2}{2}\int_0^dx dx = \frac{d^4}{4}$$
Now the function $q_1(x)$ is proportional to $|p(x)f(x)|$ over all $x \in [0,1]$, but this has objective function $\frac{d^4}{4}|_{d=1}= 1/4$. We can do better by pushing $d\rightarrow 0$ to get an infimum objective value of $0$. This is a degenerate case when there is no minimizer but we can find a sequence of functions that satisfy the constraints and that have objective values that converge to the infimum of 0.
General case
You can repeat the example to solve almost all general cases this way: Fix $(E,\mathcal{E}, \lambda)$ and fix $p:E\rightarrow [0,\infty)$, $f:E\rightarrow\mathbb{R}$ and suppose that for all positive integers $n$ there is a measurable set $B_n \subseteq E$ such that $$ 0<\int_{B_n} |p(x)f(x)|d\lambda \leq 1/n$$ Define $$c_n = \int_{B_n} |p(x)f(x)|d\lambda \quad \forall n \in \{1, 2, 3, ..\}$$ and note that $0<c_n\leq 1/n$. For each $n \in \{1, 2, 3, ...\}$ define $q_n:E\rightarrow[0,\infty)$ by $$ q_n(x) = \left\{ \begin{array}{ll} \frac{|p(x)f(x)|}{c_n} &\mbox{ if $x\in B_n$} \\ 0 & \mbox{ otherwise} \end{array} \right.$$ Then $\int q_n(x)d\lambda = \frac{1}{c_n}\int_{B_n} |p(x)f(x)|d\lambda=1$ for all $n \in \{1, 2, 3, ...\}$ but $$ \int_{x:q_n(x)>0}\frac{(p(x)f(x))^2}{q_n(x)} d\lambda = c_n\int_{B_n}|p(x)f(x)|d\lambda = c_n^2\rightarrow 0$$ So the infimum objective value is 0.
If we assume that $\lambda(\{x \in E : p(x)f(x)=0\}) = 0$ then it can be shown that it is impossible to achieve an objective value of 0. Thus, this situation is degenerate: There is no minimizer, but there is an infinite sequence of functions that satisfy the constraints and that have objective function that converges to the infimum of 0.
On the other hand, if we can find a measurable set $B\subseteq E$ such that $0<\lambda(B) < \infty$ and $p(x)f(x)=0$ for all $x \in B$, then we can easily achieve the optimal objective value of $0$ with $$ q(x) = \left\{ \begin{array}{ll} \frac{1}{\lambda(B)} &\mbox{ if $x \in B$} \\ 0 & \mbox{ otherwise} \end{array} \right.$$