The Piwi-interacting RNA (piRNA) pathway defends animal genomes against the 
harmful consequences of transposable element (TE) infection by imposing 
small-RNA-mediated silencing. Because silencing is targeted by TE-derived 
piRNAs, piRNA production is posited to be central to the evolution of genome 
defense. We harnessed genomic data sets from Drosophila melanogaster, including 
genome-wide measures of piRNA, mRNA, and genomic abundance, along with estimates 
of age structure and risk of ectopic recombination, to address fundamental 
questions about the functional and evolutionary relationships between TE 
families and their regulatory piRNAs. We demonstrate that mRNA transcript 
abundance, robustness of "ping-pong" amplification, and representation in piRNA 
clusters together explain the majority of variation in piRNA abundance between 
TE families, providing the first robust statistical support for the prevailing 
model of piRNA biogenesis. Intriguingly, we also discover that the most 
transpositionally active TE families, with the greatest capacity to induce 
harmful mutations or disrupt gametogenesis, are not necessarily the most 
abundant among piRNAs. Rather, the level of piRNA targeting is largely 
independent of recent transposition rate for active TE families, but is rapidly 
lost for inactive TEs. These observations are consistent with population genetic 
theory that suggests a limited selective advantage for host repression of 
transposition. Additionally, we find no evidence that piRNA targeting responds 
to selection against a second major cost of TE infection: ectopic recombination 
between TE insertions. Our observations confirm the pivotal role of 
piRNA-mediated silencing in defending the genome against selfish transposition, 
yet also suggest limits to the optimization of host genome defense.