Assuming the temperature in a whale remains about the same, the volume of the ideal gas in inversely proportional to the pressure. At great depth where the pressure is 1000 times what it is on the surface, the ideal gas is compressed to 1/1000 of its volume. Fart gas might not be the ideal gas, but it acts like an ideal gas. Assuming intestinal gas production continues at the same rate at great depth as on the surface, after half an hour there will be a fair amount by weight but at small, insignificant volume. When the whale comes back up, the gas expands by a factor of 1000. That's when it has to let go. A whale ascent from the deeps is accompanied by a great deal of farting and burping. The real question is whether the whale surfaces ahead of or later than the bubbles.
That's a heckuva understatement!
Assuming intestinal gas production continues at the same rate at great depth as on the surface, after half an hour there will be a fair amount by weight but at small, insignificant volume.
I don't know that this is a valid assumption.
In my humble experience, fart gas production doesn't seem to be a continuous process, but in rather abrupt, discrete batches. (and sometimes indiscrete as well.)
I do, however, agree with what would happen if the whale tried to "hold it" until he/she reached the surface: it'd be like a humongous puffer fish blown up bigger than the Goodyear Blimp.
LOL! That's a good one! Inquiring minds want to know...8-)