Beating a dead horse, alternatively flogging a dead horse or beating a dead dog is an idiomatic phrase, used for referring to efforts which are futile, because their goal is impossible to achieve.
“Beating a dead horse” is widely attributed to British politician John Bright who first used the expression in the House of Commons in 1859, giving voice to his dissatisfaction with the results of his efforts promoting parliamentary reform.
The phrase was first noted in the Oxford English Dictionary in 1872.
“Beating a dead horse” turned into an idiomatic phrase over the years, appearing in some form all over the Anglosphere.
The earliest Urban Dictionary entry on the matter was written in 2004, with several other definitions that followed.