Chapter 2 of A Study in Scarlet is titled "The Science of Deduction," so it is not surprising to find there some important insights about Holmes's method. In this chapter, Watson, when first getting to know Holmes and trying to figure out what profession Holmes is engaged in, is surprised by the peculiar and uneven nature of the other's expertise:
within eccentric limits his knowledge was so extraordinarily ample and minute that his observations have fairly astounded me . . . .
Holmes is extremely knowledgeable about certain, often startlingly strange, subjects. (He can, for example, identify where in London he got different splashes of mud after going for a walk, and his ability to tell the difference between types of tobacco ash comes into play in several stories.) But regarding other, often very common, things:
His ignorance was as remarkable as his knowledge . . . . My surprise reached a climax, however, when I found incidentally that he was ignorant of the Copernican Theory and of the composition of the Solar System.
It turns out that Holmes has a particular theory of mind and memory that has led him into this state of knowledge. He says,
I consider that a man’s brain originally is like a little empty attic, and you have to stock it with such furniture as you choose. A fool takes in all the lumber of every sort that he comes across, so that the knowledge which might be useful to him gets crowded out, or at best is jumbled up with a lot of other things so that he has a difficulty in laying his hands upon it. Now the skilful workman is very careful indeed as to what he takes into his brain-attic. He will have nothing but the tools which may help him in doing his work, but of these he has a large assortment, and all in the most perfect order. It is a mistake to think that that little room has elastic walls and can distend to any extent. Depend upon it there comes a time when for every addition of knowledge you forget something that you knew before. It is of the highest importance, therefore, not to have useless facts elbowing out the useful ones.
It is not only the facts of each individual, specific case that are central to Holmes's deductive method (see the previous answer). This data requires an expansive and detailed set of general facts, accumulated and stored as the background knowledge from which Holmes draws in order to interpret the observations, clues, and details of each case. Thus, what Holmes considers worth learning is entirely dictated by his work as a detective, as odd as some of his choices may seem:
“But the Solar System!” I protested.
“What the deuce is it to me?” he interrupted impatiently; “you say that we go round the sun. If we went round the moon it would not make a pennyworth of difference to me or to my work.”