16S rRNA gene sequencing targets one gene shared by bacteria and archaea, often sequencing only part of that gene. It is a long-established survey method, but that single gene often cannot tell closely related species apart, so results are usually reported at the broader genus level and function has to be estimated from a representative in the genus or family.
Shotgun metagenomics sequences DNA across all microbes in the sample. That allows identification at species level, includes organisms beyond bacteria, and assesses the functional genes actually present in the population.
