diff --git a/src/dataExplorer/context/tags.tsx b/src/dataExplorer/context/tags.tsx index 2b25ffce2a..a5ac7f1623 100644 --- a/src/dataExplorer/context/tags.tsx +++ b/src/dataExplorer/context/tags.tsx @@ -8,7 +8,7 @@ import { CACHING_REQUIRED_END_DATE, CACHING_REQUIRED_START_DATE, } from 'src/utils/datetime/constants' -import {DEFAULT_LIMIT} from 'src/shared/constants/queryBuilder' +import {DEFAULT_INTERVAL, DEFAULT_LIMIT} from 'src/shared/constants/queryBuilder' import {LanguageType} from 'src/dataExplorer/components/resources' // Contexts @@ -214,6 +214,7 @@ export const TagsProvider: FC = ({children, scope}) => { const queryTextSQL: string = ` SELECT DISTINCT("${tagKey}") FROM "${measurement}" + WHERE time < NOW() AND time >= NOW() - INTERVAL '${DEFAULT_INTERVAL}' ORDER BY "${tagKey}" LIMIT ${DEFAULT_LIMIT} ` diff --git a/src/shared/constants/queryBuilder.ts b/src/shared/constants/queryBuilder.ts index 8ad664f989..367ca7ce2d 100644 --- a/src/shared/constants/queryBuilder.ts +++ b/src/shared/constants/queryBuilder.ts @@ -1 +1,2 @@ export const DEFAULT_LIMIT = 1000 +export const DEFAULT_INTERVAL = '1 day'