Ecclesiastes 2:23

For all his days are sorrows, and his travail grief; yea, his heart taketh not rest in the night. This is also vanity.

Solomon tested carnal worldly pleasure when he had wealth and honor and power and wisdom and everything his heart could wish at his command, setting himself to enjoy pleasure and seeking it in mirth and folly and wine. He sought it in great works and houses and vineyards, in gardens and orchards and pools of water, in servants and maidens and great possessions of cattle. He sought it in silver and gold and peculiar treasure, in men and women singers and all kinds of instrumental music, keeping nothing his eyes desired from them. The days and nights of that travail were sorrow and grief without rest of heart, which is vanity. That giving of himself over to pleasure belonged to the course that led to his spiritual decline.

The verse belongs to the book's picture of human toil and life apart from God as sorrowful and futile. Life under the curse that followed humanity's transgression is marked by sorrow and grief, where human labor brings no lasting satisfaction and worry can disturb the heart even at night. Its naming of life as vanity belongs to that sorrowful fallen condition. Human life is marked by sorrow and exhausting toil, and worry can keep the heart from resting at night, so that this troubled earthly existence is vanity. Worldly pleasure and gain bring sorrow, grief, and restless labor, and that makes them vanity.

A person's labor and success can bring sorrow, grief, worry, and unrest instead of happiness. Even great political achievements may leave a person burdened by the suffering caused and by care, with little or no joy from success. Greatness and happiness do not always go together. Reflection on this teaching helps check pride.