In many computing applications, there are several equi~alent algorithms capable of performmg a particular task, and no one is the most eflicient under all statistical dntrrbutions of the data. In such contexts, a good heunstlc is to take a sample of the database and use it to guess which procedure is likely to be the most efticlent This paper defines the very geneml notion of a differentiable query problem and shows that the Ideal sample size for guessing the optimal choice of algorithm is CJ(NZ13) for all differential problems involving approximately N executing steps. ACM 0004-541 I/91/010()-()1()4 $OI,5f)