Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 581d3b3

Browse files
committed
slight query optimizations
1 parent 2dcf1e2 commit 581d3b3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/codegate/db/connection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ async def get_messages(
680680
# Build base query
681681
base_query = """
682682
WITH filtered_prompts AS (
683-
SELECT DISTINCT p.*
683+
SELECT distinct p.id, p.timestamp, p.provider, p.request, p.type
684684
FROM prompts p
685685
LEFT JOIN alerts a ON p.id = a.prompt_id
686686
WHERE p.workspace_id = :workspace_id
@@ -710,7 +710,6 @@ async def get_messages(
710710
FROM filtered_prompts p
711711
LEFT JOIN outputs o ON p.id = o.prompt_id
712712
LEFT JOIN alerts a ON p.id = a.prompt_id
713-
ORDER BY p.timestamp DESC, o.timestamp ASC, a.timestamp ASC
714713
"""
715714

716715
# Build conditions and filters

0 commit comments

Comments
 (0)