• Tom Lane's avatar
    Allow backends to start up without use of the flat-file copy of pg_database. · 04011cc9
    Tom Lane authored
    To make this work in the base case, pg_database now has a nailed-in-cache
    relation descriptor that is initialized using hardwired knowledge in
    relcache.c.  This means pg_database is added to the set of relations that
    need to have a Schema_pg_xxx macro maintained in pg_attribute.h.  When this
    path is taken, we'll have to do a seqscan of pg_database to find the row
    we need.
    
    In the normal case, we are able to do an indexscan to find the database's row
    by name.  This is made possible by storing a global relcache init file that
    describes only the shared catalogs and their indexes (and therefore is usable
    by all backends in any database).  A new backend loads this cache file,
    finds its database OID after an indexscan on pg_database, and then loads
    the local relcache init file for that database.
    
    This change should effectively eliminate number of databases as a factor
    in backend startup time, even with large numbers of databases.  However,
    the real reason for doing it is as a first step towards getting rid of
    the flat files altogether.  There are still several other sub-projects
    to be tackled before that can happen.
    04011cc9
pg_attribute.h 31.1 KB