277 karma · joined February 22, 2024
On query guardrails: every query runs in a readonly transaction and results are capped at 500 rows via a wrapping SELECT * FROM (...) sub LIMIT 500. There's also explain_query which returns the plan without executing, so agents can check before running something expensive. That said, there's no cost-based gate that blocks a bad plan automatically; that's an interesting idea worth exploring.
pglens gives agents the context to get it right the first time: column_values shows real distinct values with counts, find_join_path does BFS over the FK graph and returns join conditions through intermediate tables, describe_table gives columns/PKs/FKs/indexes in one call. Plus production health tools like bloat_stats, blocking_locks, and sequence_health.
Everything runs in readonly transactions, identifiers escaped via Postgres's quote_ident(), no extensions required. Works on any Postgres 12+ (self-hosted, RDS, Aurora, etc.). Two dependencies: asyncpg and mcp.
https://github.com/janbjorge/pglens
pip install pglen
It uses the same core primitives people are discussing here (FOR UPDATE SKIP LOCKED for claiming work; LISTEN/NOTIFY to wake workers), plus priorities, scheduled jobs, retries, heartbeats/visibility timeouts, and SQL-friendly observability. If you’re already on Postgres and want a pragmatic “just use Postgres” queue, it might be a useful reference / drop-in.
PGQueuer is a small Python library that turns Postgres into a durable job queue using the same primitives discussed here — `FOR UPDATE SKIP LOCKED` for safe concurrent dequeue and `LISTEN/NOTIFY` to wake workers without tight polling. It’s for background jobs (not a Kafka replacement), and it shines when your app already depends on Postgres.
Nice-to-haves without extra infra: per-entrypoint concurrency limits, retries/backoff, scheduling (cron-like), graceful shutdown, simple CLI install/migrations. If/when you truly outgrow it, you can move to Kafka with a clearer picture of your needs.
Repo: https://github.com/janbjorge/pgqueuer
Disclosure: I maintain PGQueuer.
But seeing how they just treated Hack Club — sudden 40x price hike, almost no notice, threatening to cut off access and delete 11 years of history — makes me wonder if we should rethink where we build our work.
I don’t want to leave Slack. But I also don’t want to wake up one day with our team’s history held hostage.
Even with clear photographs and detailed instructions, LLMs tend to give general advice or indirect methods rather than precise, actionable steps that clearly demonstrate correctness.
Have you tried something similar? Have you successfully "prompt-engineered" an LLM into giving clear, precise, step-by-step solutions for physical puzzles? If yes, what's your approach?
I haven't deployed PipeGate on AWS; it started as a personal curiosity project. There are probably many security aspects that would need to be addressed before deploying it in a production environment.
IT's main concern is blocking any external traffic from hitting local machines, even if tunneled or encrypted. Outbound traffic is generally fine, but many external platforms require direct URLs for real-time webhooks, which makes solutions like ngrok hard to replace.
Polling an external queue from the LAN is an interesting idea—I’ll check if IT might allow that. Long-lived tunnels like SSH or Cloudflare are probably a no-go given their restrictions.
So far, no comments regarding compliance or privacy.
Thanks again for the input!
While a separate "running" table reduces skips, it adds complexity. SKIP LOCKED strikes a good balance for simplicity and performance in many use cases.
One known issue is that vacuum will become an issue if the load is persistent for longer periods leading to bloat.
If you’re already using Postgres and want a Python-native way to manage background jobs without adding extra infrastructure, PGQueuer might be worth a look: GitHub - https://github.com/janbjorge/pgqueuer
PGQueuer is a minimalist, high-performance job queue library for Python that leverages PostgreSQL's robustness, designed for real-time, high-throughput background job processing.
Key Features in This Release:
- Recurring Job Scheduling: You can now easily schedule recurring jobs using cron-like expressions with the new SchedulerManager. Ideal for automating routine tasks like data synchronization or cleanups.
- https://github.com/janbjorge/PGQueuer
disclaimer: Im the auther.
I’m currently enhancing the documentation for my project, PGQueuer.
About PGQueuer: PGQueuer is a minimalist, high-performance job queue library for Python, leveraging PostgreSQL’s LISTEN/NOTIFY for efficient job management. It’s perfect for handling background tasks and managing workflows with simplicity and reliability