summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-10-23 22:55:19 +0100
committerGitHub <noreply@github.com>2023-10-24 00:55:19 +0300
commiteabc8d4e0f250f647115e5203897f757ef9d1878 (patch)
treef711cea7ac3ee2b1ed4c4a9f3e290be63d5d6470 /web
parent4889b00c902e24090688092cd904fa512be08ffa (diff)
QUERIES: use tiers only when they have useful data (#16263)
use tiers only when they have useful data
Diffstat (limited to 'web')
-rw-r--r--web/api/queries/query.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/web/api/queries/query.c b/web/api/queries/query.c
index 8a4e94c969..b7e89ee978 100644
--- a/web/api/queries/query.c
+++ b/web/api/queries/query.c
@@ -1391,9 +1391,10 @@ static bool query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before
// find the first time of this tier
time_t tier_first_time_s = qm->tiers[tr].db_first_time_s;
+ time_t tier_last_time_s = qm->tiers[tr].db_last_time_s;
// can it help?
- if (tier_first_time_s < selected_tier_first_time_s) {
+ if (tier_first_time_s < selected_tier_first_time_s && tier_first_time_s <= before_wanted && tier_last_time_s >= after_wanted) {
// it can help us add detail at the beginning of the query
QUERY_PLAN_ENTRY t = {
.tier = tr,
@@ -1423,12 +1424,13 @@ static bool query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before
continue;
// find the last time of this tier
+ time_t tier_first_time_s = qm->tiers[tr].db_first_time_s;
time_t tier_last_time_s = qm->tiers[tr].db_last_time_s;
//buffer_sprintf(wb, ": EVAL BEFORE tier %d, %ld", tier, last_time_s);
// can it help?
- if (tier_last_time_s > selected_tier_last_time_s) {
+ if (tier_last_time_s > selected_tier_last_time_s && tier_first_time_s <= before_wanted && tier_last_time_s >= after_wanted) {
// it can help us add detail at the end of the query
QUERY_PLAN_ENTRY t = {
.tier = tr,