File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ TKikimrConfiguration::TKikimrConfiguration() {
9595 REGISTER_SETTING (*this , MaxDPccpDPTableSize);
9696
9797 REGISTER_SETTING (*this , MaxTasksPerStage);
98+ REGISTER_SETTING (*this , MaxSequentialReadsInFlight);
9899
99100 /* Runtime */
100101 REGISTER_SETTING (*this , ScanQuery);
@@ -147,6 +148,10 @@ bool TKikimrSettings::HasOptUseFinalizeByKey() const {
147148 return GetFlagValue (OptUseFinalizeByKey.Get ().GetOrElse (true )) != EOptionalFlag::Disabled;
148149}
149150
151+ bool TKikimrSettings::HasMaxSequentialReadsInFlight () const {
152+ return !MaxSequentialReadsInFlight.Get ().Empty ();
153+ }
154+
150155EOptionalFlag TKikimrSettings::GetOptPredicateExtract () const {
151156 return GetOptionalFlagValue (OptEnablePredicateExtract.Get ());
152157}
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ struct TKikimrSettings {
7272
7373
7474 NCommon::TConfSetting<ui32, false > MaxTasksPerStage;
75+ NCommon::TConfSetting<ui32, false > MaxSequentialReadsInFlight;
7576
7677 /* Runtime */
7778 NCommon::TConfSetting<bool , true > ScanQuery;
@@ -88,6 +89,7 @@ struct TKikimrSettings {
8889 bool HasOptEnableOlapPushdown () const ;
8990 bool HasOptEnableOlapProvideComputeSharding () const ;
9091 bool HasOptUseFinalizeByKey () const ;
92+ bool HasMaxSequentialReadsInFlight () const ;
9193
9294 EOptionalFlag GetOptPredicateExtract () const ;
9395 EOptionalFlag GetUseLlvm () const ;
Original file line number Diff line number Diff line change @@ -4235,7 +4235,46 @@ Y_UNIT_TEST_SUITE(KqpNewEngine) {
42354235 }
42364236 }
42374237
4238+ Y_UNIT_TEST_TWIN (SequentialReadsPragma, Enabled) {
4239+ TKikimrRunner kikimr;
4240+ auto db = kikimr.GetTableClient ();
4241+ auto session = db.CreateSession ().GetValueSync ().GetSession ();
4242+
4243+ NYdb::NTable::TExecDataQuerySettings querySettings;
4244+ querySettings.CollectQueryStats (ECollectQueryStatsMode::Profile);
4245+
4246+ TString query = R"(
4247+ SELECT Key, Data FROM `/Root/EightShard`
4248+ WHERE Text = "Value1"
4249+ ORDER BY Key
4250+ LIMIT 1;
4251+ )" ;
4252+
4253+ if (Enabled) {
4254+ TString pragma = TString (R"(
4255+ PRAGMA ydb.UseSequentialReads = "true";
4256+ )" );
42384257
4258+ query = pragma + query;
4259+ }
4260+
4261+ auto result = session.ExecuteDataQuery (query, TTxControl::BeginTx ().CommitTx (), querySettings).GetValueSync ();
4262+ UNIT_ASSERT_C (result.IsSuccess (), result.GetIssues ().ToString ());
4263+ CompareYson (R"( [[[101u];[1]]])" , FormatResultSetYson (result.GetResultSet (0 )));
4264+
4265+ auto stats = NYdb::TProtoAccessor::GetProto (*result.GetStats ());
4266+ for (const auto & phase : stats.query_phases ()) {
4267+ for (const auto & access : phase.table_access ()) {
4268+ if (access.name () == " /Root/EightShard" ) {
4269+ if (Enabled) {
4270+ UNIT_ASSERT_LT (access.partitions_count (), 8 );
4271+ } else {
4272+ UNIT_ASSERT_EQUAL (access.partitions_count (), 8 );
4273+ }
4274+ }
4275+ }
4276+ }
4277+ }
42394278
42404279}
42414280
You can’t perform that action at this time.
0 commit comments