I wonder if after the current debate, the UK ends up leaving the EU on any terms, how soon can a future government conduct a referendum to join the EU?
They can do it right away if they have the majority vote. However, it will take some time to do so, even if the UK gets fast-tracked. It may help that most standards, laws etc are already in place. Also the UK may not get conditions of membership as good as when they had before leaving, and may be required to participate in the Schengen visa scheme and the Eurozone.
Both major parties have put in their 2017 election platforms leaving the EU. So I guess it would take at least a general election and new platforms for them to do that while saving face. (Despite Labour's recent flip flops on the matter of a 2nd referendum.)
As for practical terms: as soon as the government would be confident a poll will give them the result they want.
Since the distinction has become relevant of late, a future government can’t hold a referendum. It needs legislation, which only Parliament can do. A future government can propose legislation for a new referendum to Parliament, and if it has a majority than of course the legislation is highly likely to pass. And that makes it clear that there’s no way this can be prevented from happening, since a fundamental principle of the British constitution is that Parliament cannot bind future Parliaments.