🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
perf(api): add redundant timestamp bound to scores v3 cursor for index pruning (LFE-10208) (#14230)
Niklas Semmlerde483b32b53e
diff --git a/packages/shared/src/server/repositories/scores.ts b/packages/shared/src/server/repositories/scores.tsindex 0f5059496d..ef752013e1 100644--- a/packages/shared/src/server/repositories/scores.ts+++ b/packages/shared/src/server/repositories/scores.ts@@ -2858,8 +2858,12 @@ const buildV3ListQuery = (FROM scores sWHERE s.project_id = {projectId: String}${+ // The simple timestamp bound is redundant with the tuple comparison but+ // required for index pruning: ClickHouse does not decompose tuple+ // comparisons, so only the simple bound activates the partition key and+ // the (project_id, toDate(timestamp)) primary-key prefix.withCursor- ? "AND (s.timestamp, s.id) < ({lastTimestamp: DateTime64(3)}, {lastId: String})"+ ? "AND (s.timestamp, s.id) < ({lastTimestamp: DateTime64(3)}, {lastId: String}) AND s.timestamp <= {lastTimestamp: DateTime64(3)}": ""}${filterClause ? `AND ${filterClause}` : ""}