BACKGROUND: High microbial diversity in the environment has been associated with lower asthma risk, particularly in children exposed to farming. It remains unclear whether this effect operates through an altered microbiome of the mucosal surfaces of the airways. METHODS: DNA from mattress dust and nasal samples of 86 school-age children was analyzed by 454-pyrosequencing of the 16S rRNA gene fragments. Based on operational taxonomic units bacterial diversity and composition was related to farm exposure and asthma status. RESULTS: Farm exposure was positively associated with bacterial diversity in mattress dust samples as determined by richness (p=8.1 * 10(-6) ) and Shannon index (p=1.3 * 10(-5) ). Despite considerable agreement of richness between mattress and nasal samples, the association of richness with farming in nasal samples was restricted to a high gradient of farm exposure, i.e. exposure to cows and straw versus no exposure at all. In mattress dust the genera Clostridium, Facklamia, an unclassified genus within the family of Ruminococcaceae and six OTUs were positively associated with farming. Asthma was inversely associated with richness (aOR= 0.48 [0.22-1.02]) and Shannon Index (aOR=0.41 [0.21-0.83]) in mattress dust and to a lower extent in nasal samples (richness aOR 0.63[0.38-1.06], Shannon Index aOR= 0.66 [0.39-1.12]). CONCLUSION: The stronger inverse association of asthma and bacterial diversity in mattress dust as compared to nasal samples suggests microbial involvement beyond mere colonization of the upper airways. Whether inhalation of metabolites of environmental bacteria contributes to this phenomenon should be the focus of future research.