We report on a comparison of spin relaxation rates in a $^{199}$Hg magnetometer using different wall coatings. A compact mercury magnetometer was built for this purpose. Glass cells coated with fluorinated materials show longer spin coherence times than if coated with their hydrogenated homologues. The longest spin relaxation time of the mercury vapor was measured with a fluorinated paraffin wall coating.