Without a caching layer of some sort, the number of queries used for database inspection can quickly get out of hand. Detect (if possible) that memcache is available and use that to cache a description of the database that can be loaded without queries.