Class E203_SeedVolume
Seeds a large company: Employee objects arranged as a reporting tree.
Every employee but the first reports to a manager, and every manager has
direct reports, so 100000 employees form a tree six levels deep.
The same objects answer both kinds of query:
redb.Query<EmployeeProps>().Where(e => e.Salary > 90000) // everyone
redb.TreeQuery<EmployeeProps>(managerId).Where(e => e.Salary > 90000) // one manager's people
dotnet run --project redb.Examples -- E203
REDB_SEED_COUNT=20000 dotnet run --project redb.Examples -- E203
The whole-suite sweep never seeds. Seeding runs only when the example is NAMED on the
command line (default 100000 employees). REDB_SEED_COUNT overrides the size (0 disables even an
explicit run), REDB_SEED_BATCH the batch (default 1000).
Objects have the shape E000 builds: about 60 _values rows each, with arrays, nested classes
and dictionaries, so 100000 employees land around 6M rows in _values.
This example WRITES a lot. It appends and never clears: every run adds one more company with
its own head, so running it twice doubles the data. It ends by refreshing planner statistics
through redb.Maintenance.AnalyzeAsync(); after a bulk load the planner's estimates are
stale until that is done.
[ExampleMeta("E203", "Seed volume: employees as a reporting tree", "Setup", ExampleTier.Pro, 200, new string[] { "Setup", "BulkInsert", "Tree", "Benchmark" }, RelatedApis = new string[] { "IRedbService.AddNewObjectsAsync", "IRedbContext.NextObjectIdBatchAsync" })]
public class E203_SeedVolume : ExampleBase
Inheritance
Inherited Members
Methods
RunAsync(IRedbService)
Run the example and return result.
public override Task<ExampleResult> RunAsync(IRedbService redb)