Y2NjN2U4MmI4NDBmYjIzYzM1ODRmOGM5MDJkNWZhMTliNGUyODBjOTZhMDgyM2FjMmNhMGI4MmM2MWMzOTMyNQ.mu8c81zx.eyJ1cmwiOiIvcGwvYWRtaW5pc3RyYXRvci9xdWVyeS9kYl9ydW5uaW5nX3F1ZXJpZXMiLCJhdXRobl91c2VyX2lkIjoiMSJ9
Skip to main content Accessibility guide
PrairieLearn Go home
  • Home
  • →
  • Global Admin
Load from disk
  • Dev User
    Course Requests Settings Log out
  • Administrators
  • Institutions
  • Courses
  • Requests
  • Queries
  • Workspaces
  • Features
  • Batched migrations
  • Settings

Query: db_running_queries

— Queries currently running in the DB.
Query ran at: 2026-09-19 03:13:30 (UTC)
5 rows JSON CSV
pidageusenameclientstatequery
14504 {"milliseconds":8.345} postgres172.18.0.2:54772active
SELECT * FROM "users_select_or_insert"($1,$2,$3,$4,$5,$6);
14515 {"milliseconds":6.205} postgres172.18.0.2:54884active
-- BLOCK set_session
INSERT INTO
  user_sessions (session_id, user_id, data, updated_at, expires_at)
VALUES
  (
    $1,
    $2,
    $3::jsonb,
    now(),
    $4
  )
ON CONFLICT (session_id) DO UPDATE
SET
  user_id = $2,
  data = $3::jsonb,
  updated_at = now(),
  expires_at = $4;
14513 {"milliseconds":3.09} postgres172.18.0.2:54868active
SELECT * FROM "users_select_or_insert"($1,$2,$3,$4,$5,$6);
14529 {"milliseconds":2.086} postgres172.18.0.2:55012active
SELECT
  pid,
  age (clock_timestamp(), query_start),
  usename,
  host(client_addr) || ':' || client_port AS client,
  state,
  query
FROM
  pg_stat_activity
WHERE
  state != 'idle'
ORDER BY
  age DESC;
14436 {"milliseconds":0.397} postgres172.18.0.2:59580active
-- BLOCK select_active_prairietest_reservation
WITH
  active_reservations AS (
    SELECT
      r.session_id,
      -- We consider a session to be "active" if either of the following is true:
      (
        -- The reservation is checked in but hasn't had their access start yet.
        -- We'll consider the reservation active for the first hour after check-in.
        r.checked_in IS NOT NULL
        AND r.access_start IS NULL
        AND r.access_end IS NULL
        AND $1 BETWEEN r.checked_in AND r.checked_in  + '1 hour'::interval
      )
      OR (
        -- The reservation has had their access start at some point, and the current
        -- time is within the access window.
        r.access_start IS NOT NULL
        AND $1 >= r.access_start
        AND (
          r.access_end IS NULL
          OR $1 < r.access_end
        )
      ) AS reservation_active,
      (
        -- PrairieTest accepts reports only while access is open.
        r.access_start IS NOT NULL
        AND $1 >= r.access_start
       
Recent query runs
Date Params User name User UID
2026-09-19 11:15:42 (UTC)
{}
Dev User dev@example.com
2026-09-19 03:13:30 (UTC)
{}
Dev User dev@example.com