Skip to content

Commit

Permalink
Added index and avoid json convertion (#256)
Browse files Browse the repository at this point in the history
* - Added index
- Avoid json convertion in db layer

* Add empty line at the end of file

---------

Co-authored-by: Henning Normann <[email protected]>
Co-authored-by: Terje Holene <[email protected]>
  • Loading branch information
3 people authored Oct 2, 2023
1 parent 6e367c1 commit 0e00462
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX IF NOT EXISTS notifications_processedstatus_requestedsendtime ON notifications.orders (processedstatus, requestedsendtime) INCLUDE (_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
DROP FUNCTION IF EXISTS notifications.getorders_pastsendtime_updatestatus();
CREATE FUNCTION notifications.getorders_pastsendtime_updatestatus()
RETURNS TABLE(notificationorders jsonb)
LANGUAGE 'plpgsql'
AS $BODY$
BEGIN
RETURN QUERY
UPDATE notifications.orders
SET processedstatus = 'Processing'
WHERE _id IN (select _id
from notifications.orders
where processedstatus = 'Registered'
and requestedsendtime <= now()
limit 50)
RETURNING notificationorder AS notificationorders;
END;
$BODY$;

0 comments on commit 0e00462

Please sign in to comment.