r/PostgreSQL

▲ 19 r/PostgreSQL+5 crossposts

My Orange Pi 5 Plus just ran a full SEO campaign for a local business, $0 in hosting costs making $100/month for a pilot program!

The Orange Pi 5 Plus in my stack serves as the Ollama model server, running qwen3.5:4b at about 7GB RAM. This week it powered something I'm pretty proud of.

My AI crew ran a complete local SEO campaign for a tattoo shop in San Diego. Here's what it generated automatically:

→ 8 keyword-optimized landing pages targeting San Diego

tattoo searches

→ 3 blog posts with proper meta descriptions and local

keyword targeting

→ 4 weeks of Google Business Profile posts

→ Review request SMS templates for the artists to send

after every appointment

→ Competitor research logged to PostgreSQL

The Orange Pi handled all the inference. Total AI cost for the content generation: about 30 cents in Claude API calls for the final polish pass.

A traditional SEO agency charges $1,500-2,500/month for this. The whole pipeline runs automatically every Monday morning via cron job.

Just posted a full video walkthrough showing exactly how it works, the agent architecture, the PostgreSQL schema, the Squarespace implementation, everything.

https://www.youtube.com/watch?v=a0NXVsqu5jQ

What are you all running on your Orange Pi?

u/Weird_Night_2176 — 3 days ago
▲ 110 r/PostgreSQL+1 crossposts

We’ve been trying to bring some VSCode experience (command palette, split panes, etc.) to Postgres. We thought it might be useful for anyone else looking for a minimalistic, keyboard-first setup.

Highlights:

  • Navigation: Command palette (Cmd+K) for keyboard-first navigation.
  • Layout: Split and movable tabs for managing multiple queries.
  • Workspace: State is shared across connections and databases.
  • Autocomplete: Context-aware suggestions based on your schema.
  • Visuals: Built-in graphing directly from query results.
  • History: Searchable query history that feeds into autocomplete.

It’s open-source and we’re looking for feedback: what's good or bad in your opinion?

GitHub: https://github.com/serenedb/serenedb/tree/main/serene-ui

u/mr_gnusi — 6 days ago
▲ 101 r/PostgreSQL+3 crossposts

From MemSQL to HorizonDB, an engineer’s journey with Adam Prout

For all of you who work on databases or systems code, this episode might be interesting. I had Adam Prout (distinguished engineer at Microsoft, founding architect of Azure HorizonDB) on the Talking Postgres podcast to walk through his path from MemSQL to HorizonDB—and what changed along the way.

Some of the ideas we covered:

  • Shared-storage architecture shifts where a lot of the work lives
  • Replication, durability, backups → pushed into the storage layer
  • Choosing Rust: a large class of bugs just won’t compile
  • “Good systems programming” = being very paranoid about what can go wrong
  • Why working on databases exposes you to so many parts of computer science
  • Startup vs big company tradeoffs as an engineer

There’s also an interesting thread about trying to make Postgres and Azure “fit together cleanly” like puzzle pieces.

If you’re curious, episode with audio + transcript is here: https://talkingpostgres.com/episodes/from-memsql-to-horizondb-an-engineers-journey-with-adam-prout

There’s a YouTube version too if that’s easier: https://youtu.be/dsyWz6tcfh0?si=kTMD1eTamlVneVXN

Happy to discuss—& always open to suggestions about future episode guests or topics.

u/clairegiordano — 5 days ago
▲ 46 r/PostgreSQL+1 crossposts

We just shipped a beta of pg-datahike — a PostgreSQL-wire-compatible adapter that embeds inside a Datahike process. psql, pgjdbc, Hibernate, SQLAlchemy, Odoo, Metabase all connect unmodified.

Besides the pragmatism of speaking Postgres we also have a key differentiator: SET datahike.branch = 'feature' and SET datahike.commit_id = '<uuid>' work over standard pgwire — git-like branches and commit pinning as session-level operations, no control-plane round-trip.

It is also bidirectional at the datom layer. Tables you create over SQL show up as normal Datahike schemas, queryable from Clojure with (d/q …). pg_dump roundtrips both directions.

Ships as a runnable uberjar (JDK 17+) or as a library. Writeup with tour, architecture, migration story, and gaps:

https://datahike.io/notes/datahike-speaks-postgres

Happy to answer questions. Lmk which use cases you would find particularly appealing.

u/flyingfruits — 3 days ago
▲ 19 r/PostgreSQL+4 crossposts

paradedb/benchmarker: a workload agnostic, multi-backend benchmarking tool.

Hi r/postgresql!

We just open sourced ParadeDB Benchmarker, a multi-backend benchmarking framework built on top of the excellent Grafana k6 (blog post).

One of the goals was avoiding a shared query abstraction layer. PostgreSQL queries stay PostgreSQL queries, with their own driver and native SQL.

Supports PostgreSQL, Elasticsearch, OpenSearch, ClickHouse, MongoDB, and ParadeDB with:

  • mixed read/write workloads
  • support for docker-compose profiles per backend
  • dataset loader
  • config and setup capture
  • live metrics + exported reports

One of the ah-ha moments I had building this was using the pgx Go driver in anger for the first time, I'm a Rust guy, but I'm seriously impressed with pgx and what it can do.

Any comments welcome, we will be using this to benchmark ParadeDB, but you can write your own datasets and workloads which have nothing to do with full-text search.

github.com
u/jamesgresql — 1 day ago
▲ 4 r/PostgreSQL+6 crossposts

Hey r/PostgreSQL,

I've been working with Postgres for a couple of years and kept running into the same frustration — PGAdmin for browsing, DBeaver for diagrams, handwritten migration scripts, CSV exports for anyone who wanted to see data. Everything disconnected.

So I spent the last 4 months building Schema Weaver. It's browser-based, no install needed.

Here's what it actually does:

**SQL Editor**

- Multi-file projects (organise DDL like a codebase)

- Live ER diagram that updates as you type — handles 1000+ tables

- 20-layer schema compiler: grades your schema A–F, detects missing PKs, redundant indexes, RLS gaps, circular dependencies, orphan sequences, unsafe security definers, and more — all client-side under 50ms

- Dijkstra + BFS path analysis to find shortest JOIN path between any two tables

- Schema diff (unified, side-by-side, semantic)

- Version history with one-click restore

**Migration Engine**

- Advisory locking to prevent concurrent conflicts

- Drift detection — fingerprints your DB before every push

- 6-phase safe mode for column type changes (shadow column → sync trigger → backfill → swap)

- Tamper-evident audit chain with auto-generated reverse SQL for rollback

**Resona AI**

- ReAct agentic loop with 55 purpose-built tools

- Table AI, Group AI, Global AI — anchored to actual schema context, not just text

- Surgical multi-file workspace editing — patches specific lines, preserves formatting

- Streams reasoning + tool calls in real time

**Data Explorer**

- High-performance grid with canvas-based smart column sizing

- Server-side filtering, sorting, column stats

- Agentic AI analysis — 40+ tools, generates charts, anomaly detection, PPTX/PDF reports

- Full DB export as ZIP (CSV, JSON, Excel, SQL)

- Read-only by default, automatic PII masking

Full Postgres support: partitions, RLS, composite types, domains, materialized views, PL/pgSQL, extensions — PG 12–17.

---

I'm in early testing phase and genuinely want to know:

- What breaks?

- What's missing that you'd actually use?

- Is the compiler catching issues you care about?

- Does the AI understand your schema or does it hallucinate?

Free to try, no credit card:

🔗 SQL Editor: sql-editor.schemaweaver.vivekmind.com

🔗 Data Explorer: data-explorer.schemaweaver.vivekmind.com

🔗 Docs: docs.schemaweaver.vivekmind.com

landing page: https://schemaweaver.vivekmind.com/

Happy to answer any questions about how it's built.

u/Vivek-Kumar-yadav — 10 days ago

Migrating SPLs with Complex Types (from Informix)

I am working on porting some stored functions from Informix; the functions on Informix use complex types (ROW & MULTISET in Informix speak), like:

RETURNING MULTISET ( ROW (equipment_id INT, meter_reading FLOAT, event_date DATETIME YEAR TO DAY, date_diff INT, hour_diff INT, max_hours INT, record_id INT, valid CHAR(1)) NOT NULL );
-- DEFINE THE MULTISET
DEFINE v_return MULTISET ( ROW (equipment_id INT, meter_reading FLOAT, event_date DATETIME YEAR TO DAY, date_diff INT, hour_diff INT, max_hours INT, record_id INT, valid CHAR(1)) NOT NULL );

In Informix it is possible to insert into a MULTISET (essentially an array) as if it is a table, and then that can be returned from the SPL.

  INSERT INTO TABLE(v_return) VALUES (
    ROW (v_result.equipment_id,
         v_result.meter_reading,
         v_result.event_date,
         v_datediff, v_meterdiff,
         v_maxhours,
         v_result.record_id,
         v_valid) );

I get that I can create arrays of composite types in Postgresql plpgsql like

CREATE TYPE xyz AS(); abc xyz%TYPE[]

but I'm missing if there is syntax to insert row into the array.

Is there no equivalent of ROW/MULTISET behavior in plpgsql?

reddit.com
u/whitemice — 2 days ago

In SQL Server my steps are:

  1. Run a load test to hammer the database for awhile.
  2. Look at the 'missing index' system view for easy wins.
  3. Look at Query Store for the most expensive queries that probably need to be rewritten.
  4. Attach the profiler and just watch the traffic for anything out of the ordinary.

I know how to read execution plans and create indexes. But that's step 5, I'm stuck on how to find the bad queries in the first place.

reddit.com
u/grauenwolf — 6 days ago
▲ 0 r/PostgreSQL+1 crossposts

Your /list endpoint is fast on page 1. Page 1000 takes 30 seconds. What now?

OFFSET doesn't skip rows. It scans them and throws them away. LIMIT 50 OFFSET 10000 makes the database visit 10,050 rows and discard the first 10,000. Every time. The fix everyone knows is cursors — but the gotchas around non-unique sort keys silently dropping records, unsigned cursors being an auth bypass on multi-tenant APIs, and why COUNT(*) is often slower than the actual query are the parts that actually bite you in production.

bubble.ro
u/indy2kro — 5 days ago

I have been working as a Oracle DBA, and recently we started using PostgreSQL. We use PgBouncer, but as the app grew, we’re still ending up with a high number of DB sessions (around 650). PgBouncer helps with pooling, but it can’t prevent a large number of parallel active sessions from reaching the database.

The app team doesn’t fully understand PostgreSQL’s limitations when it comes to connection/session scaling, especially compared to Oracle, where we didn’t face this kind of restriction before. Because of that, they are pushing to increase 'max_connections' (already 800!) and CPU count on VMs, but we’re already seeing high CPU usage at this level.

The workload consists of a very large number of short-running queries executed in parallel active sessions.

My view is that the focus should be on optimizing the middle layer (connection handling, pooling strategy, and concurrency control), rather than increasing database limits and resources further.

What do you think?

reddit.com
u/Charming-Fall-8918 — 8 days ago

so im working on some school work related to postgreSQL and was able to figure things out and was nearing completion. Our professor had us making a trigger and function for a data base and needed a "proof of work" that both trigger and function work, and this is where i came to a stop.

when i came to test the trigger it gave me this error: An error has occurred: ERROR: control reached end of trigger procedure without RETURN

and searching online it said i just needed to add a return statement to my trigger so i did. but apparently that doesn't work as well and I got a syntax error instead

is there anything i did wrong in this query? my function is fine from what ive seen but this one isn't apparently??

u/Dismal_Cockroach_898 — 8 days ago

I'm new to Postgresql and my first app is basically a search engine for cooking recipes.

I have a database table of webpages (title, url, etc) that I scraped from various sites and blogs

Right now I have a django app which displays a search bar and uses Postgres as the backend

I'm wondering if it would be easier to just remake this web portal in PHP since all it's really doing is forwarding queries to the database then displaying the results

This is just a hobby website for now and I don't think I'll need to scale it up a lot

What do you think? Am I understanding the problem correctly?

reddit.com
u/maximo66 — 7 days ago

I have 2 PG Servers (on different hosts, same PG ver. 17). After recover the same backup on both servers, and after run "vacuum full analyze" y get two different database size, why ? same rowcount on all tables, same db objects. (basically same backup!). DB was created from scratch, same encoding, etc.

reddit.com
u/Sb77euorg — 8 days ago
▲ 2 r/PostgreSQL+1 crossposts

Been running a distributed AI agent stack for 2 months with PostgreSQL as the persistent memory layer. Wanted to share the schema design since I haven't seen many examples of this pattern.

The setup: PostgreSQL 14 running on an Odroid XU4, accessed by 14 CrewAI agents running on a separate Jetson Orin Nano Super node. All connections go over the local network.

The schema:

conversations: stores all WhatsApp messages between me and the AI CEO. 54+ rows and growing.

agent memory: structured summaries the agents write after each session. 75+ entries. This is how agents remember context between runs without embedding search.

crew runs: logs every crew session with start time, status, and output summary.

paper trades: full trade ledger. symbol, entry/exit price, P&L, reasoning, agent that made the call.

treasury: tracks paper capital across USD, BTC, ETH, SOL.

seo campaigns, seo content, seo competitors: the content pipeline for a local business SEO service.

approvals, ventures, daily briefings: operational tables for the AI company structure.

The interesting design decision: agents write summaries to memory after each run rather than storing raw outputs. Keeps the table lean and queryable without needing a vector store. Works well for structured recall.

Anyone else using PostgreSQL as agent memory? Curious how others are handling the structured vs semantic tradeoff.

Full build documented on Youtube and build document in my bio!

reddit.com
u/Weird_Night_2176 — 6 days ago

a deep dive on what breaks inside PostgreSQL when you connect an AI agent to it — connection pools, query planner, locks, the works.

TL;DR: A traditional app holds a DB connection for ~5ms. An AI agent holds it for ~6,000ms because the connection stays open while the LLM thinks. That's a 1,200x reduction in effective throughput from the same pool.

The article traces a single agent-generated query through every layer of the database — connection pool, query planner, schema inference, lock manager — and shows where each assumption breaks.

Full article: https://medium.com/@visheshrawal/what-really-happens-inside-your-database-when-an-ai-agent-starts-querying-6d5254aeaa78

u/Practical-Layer-4208 — 8 days ago

So I'm working on a Deno project that needs a database, and I've determined that Postgres is the best choice for me. However, looking at all the frameworks and platforms, I'm getting quite overwhelmed.

Where should I get started? Assuming I just want to run it on my local machine for development, what resources are there to learn?

reddit.com
u/Sam54123 — 8 days ago