There is something wrong with the statistical method of permanent residents, which must be registered population+foreigners with temporary residence permits, and foreigners have to live for more than half a year. Beijing is the capital, and many people are traveling or doing business for a short time, so they won't stay for long at all. There are still many people who never apply for temporary residence permits. So the actual population of Beijing far exceeds that of Shanghai;
Most people in Beijing are concentrated in several districts of the city, so the density is very high;
The management level of Beijing is definitely higher than that of Shanghai, and the population density of many areas in Beijing is much higher than that of the Bund in Shanghai, and this is the case all the year round. I don't see any trampling. To put it bluntly, southerners are scattered and difficult to manage.