Why we have the saying “Sweating like a pig” when pigs do not sweat?

Pigs do not sweat because they do not have sweat glands (well maybe just a few).  So where did the saying “sweating like a pig” come from?

The pig in the saying is not the animal pig, but the pig iron in iron smelting.  When the hot iron pigs are dumped into the sand, moisture appears on the iron pigs due to the cooling effect and the air reaching its dew point.

This moisture appearing, known as the pig sweating, means that the iron pigs are cool enough to be moved.