A great genealogical and social historical source are city directories. These are books that typically list the heads of households and businesses within a city. Information contained can include names, profession/employer, and/or whether the person is a boarder, renter, or owner. Often, these books contain advertisements for businesses. The first ones published in America were by two competing companies in Philadelphia in 1785. The earliest directories in the UK on Ancestry.com are from 1766.
Then, I found a paper on European city directories. (Note: you can get a free account on JSTOR and read 100 free articles a month.) This paper says that earlier studies have placed the origins of European directories with the first London directory of 1677, or, on continental Europe, with the Paris directory of 1691. However, other studies have placed the origins of the idea for a city directory with Michel Eyquem de Montaigne in his 1580 and 1588 Essais. The paper goes on to place the implementation of these ideas to Théophraste Renaudot who created one of the first employment agencies in 1630, using a city directory. Origins of the implementation of city directories in Germany trace to the end of the Thirty Years' War (~1648).
This paper goes on to describe three geographical regions and the time of the emergence for city directories in that area. They are:
Britain, France, Germany, Sweden, and Denmark, which had directories between the late 18th and early 19th centuries.
Austria, Belgium, Holland, and Switzerland, around the mid-19th century.
Norway, Finland, Italy, Spain, Portugal, Greece and Russia, around the latter part of the 19th century.
I tried searching for "first/ancient" "Chinese/Indian city directory" and several other variations but I find nothing for either of these countries (other than some modern city directories and a whole bunch of irrelevant garbage). I thought a city directory sounded like an Ancient Rome thing, so I searched for a directory for Ancient Rome but the only results were for modern city directories of Rome, GA, NY, AL, and many more. Looking for an ancient Greek city directory returns GreekAncestry.net's database of city directories from Greece and a bunch of lists of ancient Greek cities.
Considering that, after 1 A.D., [some cities exceeded half a million people], I would think that sometime, somewhere someone would have had the idea of a city directory before 1580. I mean, really, having 500 different tradespeople is considerable enough (at least in my mind) to warrant some kind of directory. When we start talking about potentially thousands of entries in countries that have been literate for millennia, it would be really surprising that none of these other societies had devised some sort of directory a little earlier.
To be clear, a city directory would differ from a census in its purpose and by whom it is conducted. The primary purposes of censuses initially were either financial planning (i.e. taxation or military needs) or military (i.e. conscription), and were conducted by governments. A city directory would have a more commercial purpose of linking (initially, I imagine, foreign) traders to local tradespeople and would have been undertaken by some non-governmental entity. Thanks.