How was the Hagia Sophia built in five years, when the great cathedrals of the middle ages took centuries?

by Sarantium

Justinian was able to go from the fires of the Nika Riots to opening his massive church in five years. I know the Romans/Byzantines had massive resources at their disposal (and some corners we're probably cut since the dome did fall a few decades later) but still how was it built so fast compared to Notre Dame?

Was it simply the amount of resources a continental empire could bring to the table compared to relatively small European towns? Even still five years vs two hundred years is an insane difference.

Meninaeidethea

Here's a link to the response by u/FlavivsAetivs when I asked the same question on the Notre Dame thread from yesterday, which should be a decent start