Melatonin is a hormone supplement available without a prescription, working with the body's natural circadian signaling; its effect is generally milder than trazodone's. Trazodone requires a prescription and produces more pronounced sedation through antihistamine and serotonin receptor activity.
Many people try melatonin first for milder or occasional sleep trouble, reserving trazodone for more persistent insomnia or when coexisting depression makes trazodone's dual effect useful. They're not mutually exclusive, though combining them should be discussed with a prescriber given their additive sedative effects.