Skip to content

Commit c1a3010

Browse files
committed
Optimize AcquireNotificationMessages to drop a join
This has the unfortunate side-effect of not allowing the AcquireNotificationMessagesRow.Payload type to be overriden to []byte as it was previously, but it does not change the semantics Signed-off-by: Danny Kopping <danny@coder.com>
1 parent 703559c commit c1a3010

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

coderd/database/queries.sql.go

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/notifications.sql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ WITH acquired AS (
7272
FOR UPDATE OF nm
7373
SKIP LOCKED
7474
LIMIT sqlc.arg('count'))
75-
RETURNING id)
75+
RETURNING *)
7676
SELECT
7777
-- message
7878
nm.id,
@@ -82,8 +82,7 @@ SELECT
8282
-- template
8383
nt.title_template,
8484
nt.body_template
85-
FROM acquired
86-
JOIN notification_messages nm ON acquired.id = nm.id
85+
FROM acquired nm
8786
JOIN notification_templates nt ON nm.notification_template_id = nt.id;
8887

8988
-- name: BulkMarkNotificationMessagesFailed :execrows

0 commit comments

Comments
 (0)