Path: redb/redb.Tests.Integration/Tests/SqlitePro/SqliteProLiteralStructureIdsTests.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Tests.Integration/Tests/SqlitePro/SqliteProLiteralStructureIdsTests.cs ---- using redb.Core.Query; using redb.Core.Query.Aggregation; using redb.Tests.Integration.Fixtures; using redb.Tests.Integration.Models; using redb.Tests.Integration.Tests.Base; namespace redb.Tests.Integration.Tests.SqlitePro; [Collection("SqlitePro")] public class SqliteProLiteralStructureIdsTests : LiteralStructureIdsTestsBase { public SqliteProLiteralStructureIdsTests(SqliteProFixture fixture) : base(fixture.Redb) { } /// /// An aggregate over value rows lists its structures as a row list, IN (VALUES (id), ...): with a bare literal list /// SQLite drove the non-covering IX__values__structures and read every row of the structures with a table lookup each /// (Sum and Average of the first element of an array over 100 000 objects: 255 ms -> 420 ms); with the row list the /// objects of the scheme drive. The ids stay in the text. /// [Fact] public async Task AggregateOverValueRows_ListsItsStructuresAsRows() { await Redb.SyncSchemeAsync(); var sql = await Redb.Query() .ToAggregateSqlStringAsync(x => new { Sum = Agg.Sum(x.Props.SkillLevels![0]), Avg = Agg.Average(x.Props.SkillLevels![0]) }); sql.Should().MatchRegex(@"WHERE v\._id_structure IN \(VALUES \(\d+\)(, \(\d+\))*\)", "the structures go in as a row list"); sql.Should().NotMatchRegex(@"WHERE v\._id_structure IN \(\d", "a bare literal list lets SQLite drive the structures index"); } }