How to sample when the size of the two populations differ greatly I have to compare the distributions (means, variance, ratio of specific features, etc.) of two populations. However, the sizes of the two populations differ a lot, one with only 30,000 observations, another with nearly 1 billion observations. Retrieving all 1 billion data from population 2 costs too much, but getting 30,000 data from population 1 is affordable. What is the proper way to sample two populations so that the statistical hypothesis testing methods stay meaningful and robust?
Should I sample 30,000 observations from population 2 and compare that with population 1, or sample 33 million from population 2 (which is still considered too large to me) and 1,000 from population 1 so the ratio of sample sizes is consistent with that of the populations, or maybe some other ways to do the sampling?
And, what if I don't know the exact size of population 2, all I know is it's at least 1 billion, is there any good method to sample it?
 A: A key part of designing a study is to use a 'power and sample size' procedure to determine what sample size is necessary in order to have a good chance of a useful result---such as detecting a difference of a certain size it it exists. The procedures for determining sample sizes in 2-sample experiments usually assume that you will use equal sample sizes for the two samples.
Suppose I am planning to do a two-sided, two-sample t test to analyze my data. I will test at the 5% level, looking for a difference as small as 2 units, and knowing or assuming that the population variances are 5 units. I would like to be 90% sure that I will detect this difference, if it is present. (That is, I want power $0.9.)$
The power and sample size procedure in a recent version of Minitab gives the following results for the necessary sample size in each group.
Power and Sample Size 

2-Sample t Test

Testing mean 1 = mean 2 (versus ≠)
Calculating power for mean 1 = mean 2 + difference
α = 0.05  Assumed standard deviation = 5


            Sample  Target
Difference    Size   Power  Actual Power
         2     133     0.9      0.901483

The sample size is for each group.

Now suppose I wonder what additional power my test would have if I were to spend the money/effort to
use a sample size of 300 in one of the two samples (keeping the other group at 133).
I can do a simulation in R to get an approximate answer.
set.seed(523)
pv = replicate(10^5, t.test(rnorm(300, 100, 5), 
               rnorm(133, 102, 5), var.eq=T)$p.val)
mean(pv <= .05)
[1] 0.96939

The extra observations in the first group have increased my power from 0.90 to about 0.97.
But what would have happened to the power if
I had split the 433 observations equally between
the two groups? The answer from simulation is about
0.985.  For this balanced design, Minitab gives 0.986. 
set.seed(2020)
pv = replicate(10^5, t.test(rnorm(217, 100, 5), 
               rnorm(217, 102, 5), var.eq=T)$p.val)
mean(pv <= .05)
[1] 0.98541

Minitab
...
             Sample
 Difference    Size     Power
          2     217  0.986000

A: You should use all data from Population 1, since it is practical to do so.  I can scarcely think of an analysis in which it would be preferable to preserve uncertainty about Population 1 rather than definitively to establish its parameters.  Just because there will "certainly be uncertainty" about Population 2 does not mean your knowledge about Population 1 should be reduced to match that level.  Recall that, e.g., a Z-test of means that relies on a comparison to a known parameter will be more efficient than an corresponding T-test that compares two samples. 
Power considerations as discussed by@BruceET may come into play, most likely if you are analyzing rare events or "narrow distributions."  How power might be affected by having unequal sample sizes is a matter that varies by type of procedure.  But it will never hurt power to collect a larger sample from one population, even if the two sample sizes differ.  I disagree with @BruceET when he writes, "Most two-sample procedures work best when the two sample sizes are equal."  Instead I'd say that most conveniently available guidelines about power assume equal sizes; that is not the same thing.
There's another consideration.  You may be using the term "population" to mean "sampling frame."  Beyond the groups of ~ 30,000 and ~1B that you describe, are there still larger groups to which you seek to generalize?  In that case the latter would be the true "populations", while the ~30,000 and ~1B would be sampling frames -- initial or realistic samples from which you might draw still smaller samples to analyze. 
