We consider a linear regression model with regression parameters (theta(1),...,theta(p)) and error variance parameter sigma(2). Our aim is to find a confidence interval with minimum coverage probability 1 - alpha for a parameter of interest theta(1) in the presence of nuisance parameters (theta(2),..,theta(p), sigma(2)). We Consider two confidence intervals, the first df which is the standard confidence interval for theta(1) with coverage probability 1 - cu. The second confidence interval for theta(1) is obtained after a variable selection procedure has been applied to theta(p). This interval is chosen to be as short as possible subject to the constraint that it has minimum coverage probability 1 - alpha. The confidence intervals are compared using a risk function that is defined as a scaled version of the expected length of the confidence interval. We show that, subject to certain conditions including that [(dimension of response vector) - p] is small, the second confidence interval is preferable to the first when we anticipate (without being certain) that \theta(p)\/sigma is small. This comparison of confidence intervals is shown to be mathematically equivalent to a corresponding comparison of prediction intervals.