@@ -41,29 +41,6 @@ public function testBenchmarks(): void
4141 ], Usage::TYPE_EVENT );
4242 });
4343
44- $ this ->runBench ('bench_events_topN_path_30d ' , function (string $ queryId ) use ($ start , $ end ): void {
45- $ this ->adapter ->setNextQueryId ($ queryId );
46- $ this ->usage ->find ([
47- UsageQuery::groupBy ('path ' ),
48- Query::equal ('metric ' , [$ this ->metric ]),
49- Query::greaterThanEqual ('time ' , $ start ),
50- Query::lessThanEqual ('time ' , $ end ),
51- Query::limit (500 ),
52- ], Usage::TYPE_EVENT );
53- });
54-
55- $ this ->runBench ('bench_events_topN_method_status_30d ' , function (string $ queryId ) use ($ start , $ end ): void {
56- $ this ->adapter ->setNextQueryId ($ queryId );
57- $ this ->usage ->find ([
58- UsageQuery::groupBy ('method ' ),
59- UsageQuery::groupBy ('status ' ),
60- Query::equal ('metric ' , [$ this ->metric ]),
61- Query::greaterThanEqual ('time ' , $ start ),
62- Query::lessThanEqual ('time ' , $ end ),
63- Query::limit (200 ),
64- ], Usage::TYPE_EVENT );
65- });
66-
6744 $ this ->runBench ('bench_events_count_max_5k ' , function (string $ queryId ) use ($ start , $ end ): void {
6845 $ this ->adapter ->setNextQueryId ($ queryId );
6946 $ this ->usage ->count ([
@@ -93,37 +70,7 @@ public function testBenchmarks(): void
9370 $ this ->usage ->addBatch ($ batch , Usage::TYPE_EVENT );
9471 }, 3 );
9572
96- // Multi-dim MV target scenarios — until P3.3 routes through the MVs
97- // these still scan raw events, providing the baseline numbers that
98- // commit 5 will compare against.
99- $ this ->runBench ('bench_events_topN_country_30d ' , function (string $ queryId ) use ($ start , $ end ): void {
100- $ this ->adapter ->setNextQueryId ($ queryId );
101- $ this ->usage ->find ([
102- UsageQuery::groupBy ('country ' ),
103- Query::equal ('metric ' , [$ this ->metric ]),
104- Query::greaterThanEqual ('time ' , $ start ),
105- Query::lessThanEqual ('time ' , $ end ),
106- Query::limit (200 ),
107- ], Usage::TYPE_EVENT );
108- });
109-
110- $ this ->runBench ('bench_events_topN_service_30d ' , function (string $ queryId ) use ($ start , $ end ): void {
111- $ this ->adapter ->setNextQueryId ($ queryId );
112- $ this ->usage ->find ([
113- UsageQuery::groupBy ('service ' ),
114- Query::equal ('metric ' , [$ this ->metric ]),
115- Query::greaterThanEqual ('time ' , $ start ),
116- Query::lessThanEqual ('time ' , $ end ),
117- Query::limit (200 ),
118- ], Usage::TYPE_EVENT );
119- });
120-
121- // Multi-dim MV scenarios — bench_*_mv variants exercise the same
122- // request shape with setUseDailyRollups on. Commit 5 wires the
123- // routing through; until then both variants scan raw and produce
124- // the same numbers.
125- $ this ->runBench ('bench_events_topN_path_30d_mv ' , function (string $ queryId ) use ($ start , $ end ): void {
126- $ this ->adapter ->setUseDailyRollups (true );
73+ $ this ->runBench ('bench_events_topN_path_30d ' , function (string $ queryId ) use ($ start , $ end ): void {
12774 $ this ->adapter ->setNextQueryId ($ queryId );
12875 $ this ->usage ->find ([
12976 UsageQuery::groupBy ('path ' ),
@@ -132,11 +79,9 @@ public function testBenchmarks(): void
13279 Query::lessThanEqual ('time ' , $ end ),
13380 Query::limit (500 ),
13481 ], Usage::TYPE_EVENT );
135- $ this ->adapter ->setUseDailyRollups (false );
13682 });
13783
138- $ this ->runBench ('bench_events_topN_country_30d_mv ' , function (string $ queryId ) use ($ start , $ end ): void {
139- $ this ->adapter ->setUseDailyRollups (true );
84+ $ this ->runBench ('bench_events_topN_country_30d ' , function (string $ queryId ) use ($ start , $ end ): void {
14085 $ this ->adapter ->setNextQueryId ($ queryId );
14186 $ this ->usage ->find ([
14287 UsageQuery::groupBy ('country ' ),
@@ -145,11 +90,9 @@ public function testBenchmarks(): void
14590 Query::lessThanEqual ('time ' , $ end ),
14691 Query::limit (200 ),
14792 ], Usage::TYPE_EVENT );
148- $ this ->adapter ->setUseDailyRollups (false );
14993 });
15094
151- $ this ->runBench ('bench_events_topN_service_30d_mv ' , function (string $ queryId ) use ($ start , $ end ): void {
152- $ this ->adapter ->setUseDailyRollups (true );
95+ $ this ->runBench ('bench_events_topN_service_30d ' , function (string $ queryId ) use ($ start , $ end ): void {
15396 $ this ->adapter ->setNextQueryId ($ queryId );
15497 $ this ->usage ->find ([
15598 UsageQuery::groupBy ('service ' ),
@@ -158,11 +101,9 @@ public function testBenchmarks(): void
158101 Query::lessThanEqual ('time ' , $ end ),
159102 Query::limit (200 ),
160103 ], Usage::TYPE_EVENT );
161- $ this ->adapter ->setUseDailyRollups (false );
162104 });
163105
164- $ this ->runBench ('bench_events_topN_method_status_30d_mv ' , function (string $ queryId ) use ($ start , $ end ): void {
165- $ this ->adapter ->setUseDailyRollups (true );
106+ $ this ->runBench ('bench_events_topN_method_status_30d ' , function (string $ queryId ) use ($ start , $ end ): void {
166107 $ this ->adapter ->setNextQueryId ($ queryId );
167108 $ this ->usage ->find ([
168109 UsageQuery::groupBy ('method ' ),
@@ -172,13 +113,11 @@ public function testBenchmarks(): void
172113 Query::lessThanEqual ('time ' , $ end ),
173114 Query::limit (200 ),
174115 ], Usage::TYPE_EVENT );
175- $ this ->adapter ->setUseDailyRollups (false );
176116 });
177117
178118 $ todayStart = (new \DateTime ('today ' , new \DateTimeZone ('UTC ' )))->format ('Y-m-d H:i:s ' );
179119 $ todayEnd = (new \DateTime ('+2 hour ' ))->format ('Y-m-d H:i:s ' );
180120 $ this ->runBench ('bench_events_topN_path_today_partial ' , function (string $ queryId ) use ($ todayStart , $ todayEnd ): void {
181- $ this ->adapter ->setUseDailyRollups (true );
182121 $ this ->adapter ->setNextQueryId ($ queryId );
183122 $ this ->usage ->find ([
184123 UsageQuery::groupBy ('path ' ),
@@ -187,12 +126,9 @@ public function testBenchmarks(): void
187126 Query::lessThanEqual ('time ' , $ todayEnd ),
188127 Query::limit (500 ),
189128 ], Usage::TYPE_EVENT );
190- $ this ->adapter ->setUseDailyRollups (false );
191129 });
192130
193- // Must route to raw — filter on a column the path MV doesn't index.
194131 $ this ->runBench ('bench_events_topN_path_30d_filtered_resource ' , function (string $ queryId ) use ($ start , $ end ): void {
195- $ this ->adapter ->setUseDailyRollups (true );
196132 $ this ->adapter ->setNextQueryId ($ queryId );
197133 $ this ->usage ->find ([
198134 UsageQuery::groupBy ('path ' ),
@@ -202,12 +138,9 @@ public function testBenchmarks(): void
202138 Query::lessThanEqual ('time ' , $ end ),
203139 Query::limit (500 ),
204140 ], Usage::TYPE_EVENT );
205- $ this ->adapter ->setUseDailyRollups (false );
206141 });
207142
208- // Multi-dim breakdown — no single MV covers both path AND country.
209143 $ this ->runBench ('bench_events_topN_path_country ' , function (string $ queryId ) use ($ start , $ end ): void {
210- $ this ->adapter ->setUseDailyRollups (true );
211144 $ this ->adapter ->setNextQueryId ($ queryId );
212145 $ this ->usage ->find ([
213146 UsageQuery::groupBy ('path ' ),
@@ -217,7 +150,6 @@ public function testBenchmarks(): void
217150 Query::lessThanEqual ('time ' , $ end ),
218151 Query::limit (500 ),
219152 ], Usage::TYPE_EVENT );
220- $ this ->adapter ->setUseDailyRollups (false );
221153 });
222154
223155 // Write fan-out cost with all MVs attached. Compare against
0 commit comments