Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix: improve ingestion pipeline by id query (#3883)

Max Deichmann11c791ae3865
diff --git a/worker/src/services/IngestionService/index.ts b/worker/src/services/IngestionService/index.ts
index 8bdcef346d..2d6efde7e5 100644
--- a/worker/src/services/IngestionService/index.ts
+++ b/worker/src/services/IngestionService/index.ts
@@ -581,7 +581,7 @@ export class IngestionService {
return await instrumentAsync({ name: `get-${table}` }, async () => {
const queryResult = await this.clickhouseClient.query({
- query: `SELECT * FROM ${table} WHERE project_id = '${projectId}' AND id = '${entityId}' ORDER BY updated_at DESC LIMIT 1 SETTINGS use_query_cache = false;`,
+ query: `SELECT * FROM ${table} WHERE project_id = '${projectId}' AND id = '${entityId}' ORDER BY event_ts DESC LIMIT 1 by id, project_id SETTINGS use_query_cache = false;`,
format: "JSONEachRow",
});