know which side one's bread is buttered on

To know who can help you and try to please him; know what is for your own gain.
Dick was always polite to the boss; he knew which side his bread was buttered on.
Categories: polite {v. phr.}