Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ CREATE INDEX idx_test_case_resolution_status_ts_keyset ON test_case_resolution_s

CREATE INDEX idx_query_cost_ts_keyset ON query_cost_time_series(timestamp, entityFQNHash);

-- Index for listLastTestCaseResultsForTestSuite / listLastTestCaseResult performance (MySQL).
-- Supports "latest row per entityFQNHash" in data_quality_data_time_series.
-- Use with FORCE INDEX (idx_entity_timestamp_desc) in TestCaseResultTimeSeriesDAO for MySQL.
ALTER TABLE data_quality_data_time_series ADD KEY idx_entity_timestamp_desc (entityFQNHash, timestamp DESC);
-- Add entityStatus generated column to glossary_term_entity table for efficient filtering
-- This supports the entityStatus filtering in the search API endpoint
ALTER TABLE glossary_term_entity
Expand All @@ -17,4 +21,4 @@ ALTER TABLE glossary_term_entity
STORED;

-- Add index for efficient entityStatus filtering
CREATE INDEX idx_glossary_term_entity_status ON glossary_term_entity (entityStatus);
CREATE INDEX idx_glossary_term_entity_status ON glossary_term_entity (entityStatus);
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ CREATE INDEX IF NOT EXISTS idx_test_case_resolution_status_ts_keyset
CREATE INDEX IF NOT EXISTS idx_query_cost_ts_keyset
ON query_cost_time_series(timestamp, entityFQNHash);

-- Index for listLastTestCaseResultsForTestSuite / listLastTestCaseResult performance.
-- Supports "latest row per entityFQNHash" in data_quality_data_time_series.
CREATE INDEX IF NOT EXISTS idx_entity_timestamp_desc
ON data_quality_data_time_series(entityFQNHash, timestamp DESC);
-- Add entityStatus generated column to glossary_term_entity table for efficient filtering
-- This supports the entityStatus filtering in the search API endpoint
ALTER TABLE glossary_term_entity
Expand All @@ -22,4 +26,4 @@ ALTER TABLE glossary_term_entity
STORED;

-- Add index for efficient entityStatus filtering
CREATE INDEX IF NOT EXISTS idx_glossary_term_entity_status ON glossary_term_entity (entityStatus);
CREATE INDEX IF NOT EXISTS idx_glossary_term_entity_status ON glossary_term_entity (entityStatus);
Original file line number Diff line number Diff line change
Expand Up @@ -7931,19 +7931,36 @@ void insert(
@Bind("json") String json,
@Bind("incidentStateId") String incidentStateId);

@SqlQuery(
"""
SELECT dqdts1.json FROM
data_quality_data_time_series dqdts1
INNER JOIN (
SELECT tc.fqnHash
FROM entity_relationship er
INNER JOIN test_case tc ON er.toId = tc.id
where fromEntity = 'testSuite' AND toEntity = 'testCase' and fromId = :testSuiteId
) ts ON dqdts1.entityFQNHash = ts.fqnHash
LEFT JOIN data_quality_data_time_series dqdts2 ON
(dqdts1.entityFQNHash = dqdts2.entityFQNHash and dqdts1.timestamp < dqdts2.timestamp)
WHERE dqdts2.entityFQNHash IS NULL""")
@ConnectionAwareSqlQuery(
value =
"""
SELECT dqdts1.json FROM
data_quality_data_time_series dqdts1
INNER JOIN (
SELECT tc.fqnHash
FROM entity_relationship er
INNER JOIN test_case tc ON er.toId = tc.id
WHERE fromEntity = 'testSuite' AND toEntity = 'testCase' AND fromId = :testSuiteId
) ts ON dqdts1.entityFQNHash = ts.fqnHash
LEFT JOIN data_quality_data_time_series dqdts2 FORCE INDEX (idx_entity_timestamp_desc) ON
(dqdts1.entityFQNHash = dqdts2.entityFQNHash AND dqdts1.timestamp < dqdts2.timestamp)
WHERE dqdts2.entityFQNHash IS NULL""",
connectionType = MYSQL)
@ConnectionAwareSqlQuery(
value =
"""
SELECT dqdts1.json FROM
data_quality_data_time_series dqdts1
INNER JOIN (
SELECT tc.fqnHash
FROM entity_relationship er
INNER JOIN test_case tc ON er.toId = tc.id
WHERE fromEntity = 'testSuite' AND toEntity = 'testCase' AND fromId = :testSuiteId
) ts ON dqdts1.entityFQNHash = ts.fqnHash
LEFT JOIN data_quality_data_time_series dqdts2 ON
(dqdts1.entityFQNHash = dqdts2.entityFQNHash AND dqdts1.timestamp < dqdts2.timestamp)
WHERE dqdts2.entityFQNHash IS NULL""",
connectionType = POSTGRES)
List<String> listLastTestCaseResultsForTestSuite(@BindMap Map<String, String> params);

@SqlQuery(
Comment thread
ndtrang marked this conversation as resolved.
Expand Down
Loading