From 91fbaeeef6c1aa5df51de757a74bd9245ce20e8a Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Thu, 25 Apr 2024 13:09:51 +0200 Subject: [PATCH] refactor(chalice): optimised error details query (#2136) --- api/chalicelib/core/errors.py | 3 +-- ee/api/chalicelib/core/errors.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/api/chalicelib/core/errors.py b/api/chalicelib/core/errors.py index 2176ccafc..ecd6f6538 100644 --- a/api/chalicelib/core/errors.py +++ b/api/chalicelib/core/errors.py @@ -152,8 +152,7 @@ def get_details(project_id, error_id, user_id, **data): INNER JOIN (SELECT MAX(timestamp) AS last_occurrence, MIN(timestamp) AS first_occurrence FROM events.errors - WHERE error_id = %(error_id)s - GROUP BY error_id) AS time_details ON (TRUE) + WHERE error_id = %(error_id)s) AS time_details ON (TRUE) INNER JOIN (SELECT session_id AS last_session_id, coalesce(custom_tags, '[]')::jsonb AS custom_tags FROM events.errors diff --git a/ee/api/chalicelib/core/errors.py b/ee/api/chalicelib/core/errors.py index 4fb472fec..affe053ca 100644 --- a/ee/api/chalicelib/core/errors.py +++ b/ee/api/chalicelib/core/errors.py @@ -159,8 +159,7 @@ def get_details(project_id, error_id, user_id, **data): INNER JOIN (SELECT MAX(timestamp) AS last_occurrence, MIN(timestamp) AS first_occurrence FROM events.errors - WHERE error_id = %(error_id)s - GROUP BY error_id) AS time_details ON (TRUE) + WHERE error_id = %(error_id)s) AS time_details ON (TRUE) INNER JOIN (SELECT session_id AS last_session_id, coalesce(custom_tags, '[]')::jsonb AS custom_tags FROM events.errors