Pyramids (novel)

Pyramids is a fantasy novel by British writer Terry Pratchett, published in 1989, the seventh book in his "Discworld" series. It won the BSFA Awards in 1989.
Plot summary.
The main character of Pyramids is Pteppic, the crown prince of the tiny kingdom of Djelibeybi (a pun on the candy Jelly Baby,) the Discworld counterpart to Ancient Egypt.
Young Pteppic has been in training at the Assassins Guild in Ankh-Morpork for several years. The day after passing his final exam he mystically senses that his father has died and that he must return home. Being the first Djelibeybian king raised outside the kingdom leads to some interesting problems, as Dios, the high priest, is a stickler for tradition, and does not actually allow the pharaohs to rule the country.
After numerous adventures and misunderstandings, Pteppic is forced to escape from the palace with a handmaiden named Ptraci, condemned to death for not wishing to die so as to aid the last king in the afterlife. Meanwhile, the massive pyramid being built for Pteppic's father warps space-time so much that it "rotates" Djelibeybi out of alignment with the space/time of the rest of the disc by ninety degrees. Pteppic and Ptraci travel to Ephebe to consult with the philosophers there as to how to get back inside the Kingdom. Meanwhile, pandemonium takes hold in Djelibeybi, as the kingdom's multifarious gods descend upon the populace, and all of Djelibeybi's dead rulers come back to life. Also, the nations of Ephebe and Tsort prepare for war with one another as Djelibeybi can no longer act as a buffer zone between the two.
Eventually, Pteppic re-enters the Kingdom and attempts to destroy the Great Pyramid, with the help of all of his newly resurrected ancestors. They are confronted by Dios, who, it turns out, is as old as the kingdom itself, and has advised every pharaoh in the history of the Kingdom. Dios hates change and thinks Djelibeybi should stay the same. Pteppic succeeds in destroying the Pyramid, returning Djelibeybi to the real world and sending Dios back through time (where he meets the original founder of the Kingdom, thereby restarting the cycle). Pteppic then abdicates, allowing Ptraci (who turns out to be his half-sister) to rule. Ptraci immediately institutes much-needed changes.
Major themes.
The novel portrays a "time polder", a bubble which comprises a particular slice of history and a particular bit of geography. In this "polder", history repeats itself through Dios, and critic Stefan Ekman argues that a central theme of the novel is the struggle breaking free from the "polder", of leaving one's background behind.