“How shall we sing the LORD's song in a foreign land?” This psalm describes the very real situation of the Israelites in Babylon: far from home, vulnerable, and desperately trying to hold on to their vision of Jerusalem. They cry out for vengeance (v8-9, a symbolic, not literal, curse on their enemies), but they are helpless. No matter what, they determined to put their longing for Jerusalem above every temporal joy (v1,6).
“When we remembered Zion” (v1). The Jews in Babylon didn’t forget their true home; even more, as redeemed people, we put the values and promise of God’s kingdom above “our highest joy” (v6).