SQL Queries Operators Actually Run Every Hour

Published 2026-05-19 by Faraz Rahimi

The useful warehouse queries are short, ugly, and run constantly. Wrap them in a screen. Do not make people open a SQL client.

SQL Queries Operators Actually Run Every Hour

Tags: SQL, Postgres, Operations, Internal Tools, unlisted

Where was this SKU last scanned. What is open on the inbound appointment. Which bins have not been touched in 30 days. That is the canon.

I keep these as views with stable names and a React page of buttons. If someone has to remember a join, the tool has already failed.

Parameters, not forks

The same query with a different SKU should not become a new file. One view, one input, a row limit so a bad wildcard cannot lock the warehouse's only replica.

I add the "as of" timestamp on every result. Stale screenshots in Slack are how rumors start.

Explain the empty set

Zero rows is a result. "No scans in 90 days" should look like a warning, not a blank table that might be a bug.

Original post: https://farazrahimi.com/posts/sql-queries-operators-actually-run-every-hour