The real origin of this expression comes from Holy writing and in its original format, (in latín), it would be: “Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos, ne forte conculcent eas pedibus suis et conversi dirumpant vos. (Matthaeum 7:6)”, what we could translate in English with “Don’t give an holy thing to a dog, don’t throw your pearl in front of a pig, it could trample it”.
The analogy between margaritas and pearl ca be find in the Real Academia de la Lengua Española (RAE) in which, if we look at the meaning, we will see that a quarter of the definitions talk about mollusc pearls because some of them are called margaritas.
“Echar margaritas a los cerdos” o “Arrojar perlas a los cerdos” means offer your generosity and your delicacy to someone who can’t appreciate it. For example, when you want to give knowledge to a person who’s not able to receive it or who doesn’t matter.
For example: offer an very interesting book to someone who couldn’t appreciate it, we can say, »Echar margaritas a los cerdos. It would be better to keep for someone who will appreciate it.