Two-dimensional electron gas (2DEG) confined in quantum wells at insulating oxide interfaces have attracted much attention as their electronic properties display a rich physics with various electronics orders such as superconductivity and magnetism. A particularly exciting features of these hetero-structures lies in the possibility to control their electronic properties by electrostatic gating, opening up new opportunities for the development of oxide based electronics. However, unexplained gating hysteresis and time relaxation of the 2DEG resistivity have been reported in some bias range, raising the question of the precise role of the gate voltage. Here we show that in LaTiO3/SrTiO3 and LaAlO3/SrTiO3 heterostructures, above a filling threshold, electrons irreversibly escape out of the well. This mechanism, which is directly responsible for the hysteresis and time relaxation, can be entirely described by a simple analytical model derived in this letter. Our results highlight the crucial role of the gate voltage both on the shape and the filling of the quantum well. They also demonstrate that it is possible to achieve a low-carrier density regime in a semiconductor limit, whereas the high-carrier density regime is intrinsically limited.