"Be on your best behaviour and be careful of your language."
The origin of the phrase "Mind your Ps & Qs" has been heavily debated - many people say it started with apprentices in 18th century print shops who would reverse the metal lowercase letters, others say it was related to teaching children to write in the early 19th century. Nobody knows for sure, but it seems that its origins are literally the letters p & q written in lowercase and have little or nothing to do with pints and quarts.
Louise Graybiel 7-6-2004
There are various proposed explanations of this. Amongst
plausible are the notion that ale used to be ordered in either pints or
quarts and you needed to be careful which you were given. The fact that
typesetters needed to be careful when setting type because the 'p's and
'q's looked similar seems a better explanation. A third, from Melissa
Shenker, is 'mind your pleases and thankyous'. This has the merit of
being closer to the meaning of the phrase although the thankyous =
thank 'q's stretches the imagination somewhat.
The Phrase Finder
Go to Sheckler "OLD DEFINITIONS"