Only run ANALYZE on the conn in bootstrap when it exists
@@ -1659,9 +1659,9 @@ async def _bootstrap(ctx: BootstrapContext) -> None:
schema = s_schema.FlatSchema()
schema = await _init_defaults(schema, compiler, tpl_ctx.conn)
- await conn.sql_execute(
- b"ANALYZE",
- )
+ # Run analyze on the template database, so that new dbs start
+ # with up-to-date statistics.
+ await tpl_ctx.conn.sql_execute(b"ANALYZE")
finally:
if in_dev_mode:
