Mind your Ps and Qs
Be on your best behaviour; be careful of your language.
Ps and Qs are just the plurals of the letters P and Q. There is some disagreement amongst grammarians about how to spell Ps and Qs - either upper-case or lower-case and either with or without an apostrophe. You may see the phrase as 'mind your p's and q's' or 'mind your Ps and Qs' or 'mind your P's and Q's' or (less often) as 'mind your ps and qs'. I've opted for Ps and Qs.
Doubts also exist as to the original meaning. Francis Grose, in his 1785 edition of The Dictionary of the Vulgar Tongue, defines it like this:
"To mind one's P's and Q's; to be attentive to the main chance."
The date of the coinage of 'mind your Ps and Qs' is uncertain. There is a citation from Thomas Dekker's play, The Untrussing of the Humorous Poet, 1602, which appears to be the earliest use of the expression:
Afinius: ...here's your cloak; I think it rains too.
Horace: Hide my shoulders in't.
Afinius: 'Troth, so thou'dst need; for now thou art in thy Pee and Kue: thou hast such a villanous broad back...
'Pee and Kue' in that citation seem to be referring to a form of clothing, but that is somewhat ambiguous. It is also not clear that the 'Pee and Kue' in Dekker's work are the same as those in 'mind one's Ps and Qs'. Dekker later used the term in West-ward Hoe, a joint work with John Webster, 1607:
At her p. and q. neither Marchantes Daughter, Aldermans Wife, young countrey Gentlewoman, nor Courtiers Mistris, can match her.
In that piece it is less apparent that 'p. and q.' refer to a form of clothing.
So, both the spelling and meaning of the phrase are debatable. Now we come to what is really uncertain - the derivation. Nevertheless, it is one of those phrases that many people are sure they know the origin of. When such folk are pressed, what they usually mean is that the person they first heard explain the origin had made a random choice from the list of proposed derivations below. As no one knows the origin I'll just list the suggestions - 'mind your Ps and Qs' probably derives from one of these:
1. Mind your pints and quarts. This is suggested as deriving from the practice of chalking up a tally of drinks in English pubs (on the slate). Publicans had to make sure to mark up the quart drinks as distinct from the pint drinks. This explanation is widely repeated but there's little to support it, apart from the fact that pint and quart begin with P and Q.
2. Advice to printers' apprentices to avoid confusing the backward-facing metal type lowercase Ps and Qs, or the same advice to children who were learning to write. I've never heard any suggestion that anyone should 'mind their Ds and Bs' though, even though that makes just as much sense and has the added benefit of rhyming, which would have made it a more attractive slogan.
3. Mind your pea (jacket) and queue (wig). Pea jackets were short rough woollen overcoats, commonly worn by sailors in the 18th century. Perruques were full wigs worn by fashionable gentlemen. It is difficult to imagine the need for an expression to warn people to avoid confusing them.
'Pee', as a name for a man's coarse coat, is recorded as early as 1485, so it is possible that that is what Dekker was referring to in his 1602 citation. If so, that usage long predates all others and we have the definitive origin of 'pee and kue'. 'Kue' or 'cue' as the name of a man's wig isn't known until well after 1602 though, so it still isn't certain what Dekker meant by it.
4. Mind your pieds (feet) and queues (wigs). This is suggested to have been an instruction given by French dancing masters to their charges. This has the benefit of placing the perruque in the right context - as long as we accept the phrase as being originally French. However, there's no reason to suppose it is from France and no version of the phrase exists in French.
5. Another version of the 'advice to children' origin has it that 'Ps and Qs' derives from 'mind your pleases and thank-yous''. That is widely touted as an origin but seems to me to be a back-formation, that is, an explanation fitted to explain the phrase after it was coined in some other context. 'Pleases and thank-yous' doesn't appear to lead to 'Ps and Qs'.
So, pay nothing and take your choice. For what it's worth, my virtual two-pennyworth goes to 2b, that is, the advice to children who were learning to write.