The init lifecycle
init performs these steps in order (you can see each in the console
output):
- Database DDLs:
pre_ddls, thenDROP/CREATE TABLEfor every table (withaccess_method/storage). Run in one transaction. - Pre-loading:
pre_load_script, if present (single connection). - Data loading:
-jparallel jobs. The1..scalefactorunit ids are round-robin distributed across jobs; each job runs the template loaders orload_scriptfor its ids. - Primary keys:
ALTER TABLE ... ADD PRIMARY KEY. - Foreign keys: unless
--no-fkey. - Indexes: all
indexes. - Vacuum:
VACUUM FREEZE ANALYZEper table, thenpost_ddls. - Checkpoint: forces a checkpoint so the run starts from a clean state.
Keys and indexes are created after loading for speed. This ordering is why
your row templates / load_script only need to produce raw column data: the
constraints are applied afterwards.