Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update recommendations API optimalquery to fetch results #919

Open
wants to merge 1 commit into
base: mvp_demo
Choose a base branch
from

Conversation

msvinaykumar
Copy link
Contributor

@msvinaykumar msvinaykumar commented Aug 28, 2023

The general strategy involves initially attempting the optimal query;
if the sum of duration is not matched and rowscount > optimal query count, then considering an alternative suboptimal query.

optimal query
select * from kruize_results k1_0 where k1_0.experiment_name=? and k1_0.interval_start_time>=? and k1_0.interval_end_time<=? order by k1_0.interval_end_time desc fetch first ? rows only

here interval_start_time = interval_end_time - (LONG_TERM_DURATION_DAYS + THRESHOLD 10 days)

suboptimal query
select * from kruize_results k1_0 where k1_0.experiment_name=? and k1_0.interval_end_time<=? order by k1_0.interval_end_time desc fetch first ? rows only

Row Limit is

        (LONG_TERM_DURATION_DAYS * 60) mins /  TrialSetting.mesurment_durationMinutes

Signed-off-by: msvinaykumar <vinakuma@redhat.com>
sum_of_duration_in_mins += entry.getDuration_minutes();
}

if (sum_of_duration_in_mins < KruizeConstants.RecommendationEngineConstants.DurationBasedEngine.DurationAmount.LONG_TERM_DURATION_DAYS * KruizeConstants.DateFormats.MINUTES_FOR_DAY) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when we have more records than is needed. Since you are setting the threshold as 10 days, you can get significantly more records than needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

3 participants