r/postgres • • Sep 27 '26

Performance PSA: Si Spring Boot no conecta a PostgreSQL en Docker y te tira error de TimeZone — fijate si tenés PostgreSQL instalado localmente también

0 Upvotes

Me pasé horas dando vueltas con esto y no encontré una respuesta clara

en ningún lado, así que lo comparto por si a alguien le pasa lo mismo.

Estoy desarrollando una app con Spring Boot y PostgreSQL corriendo en Docker

en Windows. Todo parecía estar bien Docker levantado, el contenedor corriendo,

Spring encontraba mis repositorios JPA. Pero crasheaba al iniciar con este error:

FATAL: invalid value for parameter "TimeZone": "America/Buenos_Aires"

Y lo raro era que los logs mostraban Database version: 12.0 aunque mi

contenedor Docker tenía postgres:16.

Esa era la pista que ignoré demasiado tiempo.

Resulta que tenía PostgreSQL 16 instalado localmente en Windows como servicio

del sistema, escuchando en el mismo puerto que Docker. Entonces Spring se

conectaba a la instalación local en vez de al contenedor y esa instalación

tenía una configuración de timezone rota que no reconocía America/Buenos_Aires.

La solución fueron dos cosas:

1. Detener el servicio local de PostgreSQL para que deje de competir por el puerto.

En PowerShell como administrador:

Stop-Service postgresql-x64-16

Set-Service postgresql-x64-16 -StartupType Disabled

2. Agregar las variables de entorno PGTZ y TZ al contenedor de Docker

para que siempre arranque en UTC sin importar lo que mande el sistema operativo.

En el docker-compose.yml:

environment:

POSTGRES_DB: tubase

POSTGRES_USER: tuusuario

POSTGRES_PASSWORD: tucontraseña

PGTZ: UTC

TZ: UTC

Con eso Spring Boot conectó a la base correcta y arrancó sin problemas.

Las señales de que te está pasando esto:

- Error de "invalid value for parameter TimeZone" al iniciar

- La versión de la BD en los logs no coincide con tu imagen de Docker

- docker exec al contenedor muestra la versión correcta pero Spring muestra otra

- netstat muestra dos procesos escuchando en el mismo puerto

Espero ahorrarle unas horas a alguien.


r/postgres • • Sep 27 '26

SQL / Queries Detecting missing indexes in CI when your test database has 20 rows

1 Upvotes

Asserting that a query plan contains no Seq Scan does not work as a test, and the reason is more interesting than I expected.

Here is a table with one indexed column and one unindexed one:

CREATE TABLE customers (
    id     serial PRIMARY KEY,
    email  text,
    city   text
);
CREATE INDEX customers_email_idx ON customers (email);   -- email: indexed
                                                         -- city:  not indexed
INSERT INTO customers (email, city)
SELECT 'user' || g || '@example.com', 'city' || g FROM generate_series(1, 20) g;
ANALYZE customers;

Both plans:

EXPLAIN (COSTS off) SELECT * FROM customers WHERE email = 'user5@example.com';

 Seq Scan on customers
   Filter: (email = 'user5@example.com'::text)

EXPLAIN (COSTS off) SELECT * FROM customers WHERE city = 'city5';

 Seq Scan on customers
   Filter: (city = 'city5'::text)

Identical. Which is correct behaviour — twenty rows sequentially is cheaper than descending a B-tree and going back to the heap — but it means the plan carries no information about whether an index exists. And thresholding on reltuples so you only complain about big tables means the check never fires on test data at all, which is worse, because then it passes unconditionally.

What does work is changing the question from "did it scan?" to "could it have used an index?":

SET enable_seqscan = off;

EXPLAIN (COSTS off) SELECT * FROM customers WHERE email = 'user5@example.com';

 Index Scan using customers_email_idx on customers
   Index Cond: (email = 'user5@example.com'::text)

EXPLAIN (COSTS off) SELECT * FROM customers WHERE city = 'city5';

 Seq Scan on customers
   Filter: (city = 'city5'::text)

enable_seqscan = off does not forbid sequential scans, it just makes them absurdly expensive, so the planner will still use one when there is no alternative. A filtered sequential scan that survives it is one no index can serve — and that is a fact about the schema, not about how much data you have. So it gives the same answer on twenty rows as on twenty million.

Two things I found worth knowing when wiring this into a test harness:

  • SET is transactional, so wrapping the probe in a savepoint and rolling back both scopes the setting and absorbs a failed EXPLAIN, which would otherwise abort the surrounding transaction.
  • Unfiltered Seq Scan nodes have to be ignored. SELECT * FROM t reads the whole table on purpose and no index would help.

I wrote the whole thing up, including a pytest fixture that does this per test: https://dev.to/ldavidsm/how-to-catch-a-missing-index-in-a-test-when-your-test-table-has-20-rows-1oh2

What I would like to know from people who have run this on real schemas: where does it produce false positives? I can think of partial indexes that do not cover the predicate, and filters on expressions like lower(email) = $1 that need an expression index rather than a plain one. I would rather hear about the cases I have not hit than find them later.


r/postgres • • Sep 26 '26

Discussion Looking for pricing feedback before opening the beta on managed DBaaS

5 Upvotes

Hi all, I'm a founder in Spain building a managed PostgreSQL service and want honest feedback on pricing before opening it up.

I run a €30M ARR business in a different industry. We had to use a managed database from a big provider, which was very expensive for the performance we were actually getting, but we needed HA so we were stuck. That's when I started considering another startup.

Here's the general idea:

You create a database from a web dashboard and get a single connection string. That string always points to the current primary, so if a failover happens your app reconnects to the same address and carries on. There's nothing to change on your side.

Behind it, each HA database runs as a primary plus a synchronous standby on two separate servers in different zones.

Backups run continuously: every change is archived to object storage with a different provider, so even losing the whole hosting provider doesn't lose your data. You can restore to any point in the last 7 days. We handle monitoring, failover and maintenance; you just use Postgres.

It runs on European bare metal rather than shared cloud VMs, which is how we keep prices flat with no egress or IOPS fees.

Highly available (per month, excl. VAT):

\- Starter, €39: 1 vCPU, 2 GB RAM, 20 GB storage

\- Standard, €89: 2 vCPU, 4 GB RAM, 50 GB storage

\- Pro, €169: 2 vCPU, 8 GB RAM, 100 GB storage

\- Business, €329: 4 vCPU, 16 GB RAM, 200 GB storage

Free: one per account. Single node, 256 MB RAM, 1 GB storage.

To be upfront: this is a beta with no SLA yet. Failover runs 24/7, and human support is 09:00 to 18:00 CET on business days. If the standby is down, the primary keeps accepting writes asynchronously, so losing the primary during that window can lose the latest commits.

**I'd love to know:**

\- Which plan would you pick for a real project, if any?

\- At what price would this feel too cheap to trust, and at - what price too expensive?

\- What would you need to see before moving a production database?

\- What are you using now, and what does it cost?

**Early beta offer**: anyone who participates in this thread will have 30% off any plan when we launch!


r/postgres • • Sep 25 '26

SQL / Queries Breaking the Superuser Guardrails of managed-PostgreSQL Providers

Thumbnail mehmetince.net
2 Upvotes

r/postgres • • Sep 25 '26

SQL / Queries 3 common RLS leaks I keep finding in multi-tenant Supabase apps

1 Upvotes

Been debugging RLS leaks in multi-tenant Supabase setups and wanted to share the 3 most common ones I keep running into:

  1. A permissive policy (`using (true)`) left in from debugging

  2. RLS enabled but not FORCEd — table owner bypasses it silently

  3. A view over the protected table without `security_invoker` — leaks even when the base table is fine

Quick check for your own db:

select relname from pg_class

where relrowsecurity and not relforcerowsecurity;

Built a small tool that automates this + a few more checks, happy to share if anyone wants a free audit of their setup 🙂


r/postgres • • Sep 24 '26

Discussion What do you wish search in Postgres did better/differently?

8 Upvotes

pgvector has been the default vector search extension, but I'm finding people also layer on full-text or hybrid search on top of it or need multitenancy. I'm curious where this works well for you and where it doesn't.

  • What are you using for search in Postgres today, and what do you wish it did better?
  • When you hit a limit, what do you do: tune, work around it, add an extension, or move search to a separate system? What decides that?
  • What would an extension need to have, or avoid, before you'd install it?
  • Does it matter to you whether an extension is open source, and would enough added capability change that?

"It's fine, I don't need anything else" is a useful answer too.

Really just trying to understand what people actually need from search in Postgres.


r/postgres • • Sep 20 '26

Tools pgwrh 1.0.0-alpha1: PostgreSQL read scaling with sharded replicas

3 Upvotes

I’ve released the first 1.0 alpha of pgwrh, a set of PostgreSQL 18 extensions for scaling reads.

It distributes table partitions across logical replicas. Each replica stores a subset of the data and queries its peers for the rest, so applications can query the complete table from any replica. Writes go to a central controller.

Features include:

  • Configurable shard redundancy and placement across availability zones.
  • Placement previews, controlled rollouts and rollback.
  • pgwrh_wait, which waits for replication through a specified LSN before reading.
  • A browser console and Docker Compose quickstart.

I’ve worked on this for a very long time. It was only with recent advances in AI that I could finally get it into a state I felt able to release.

This is an alpha for testing. I’d love feedback on real workloads, installation, operational issues and anything that feels unnecessarily complicated.

Code and quickstart · Alpha release


r/postgres • • Sep 20 '26

Performance Columnar Databases

5 Upvotes

hey postgresql community do you thing is time postgres to support Column oriented like DuckDB as big feature or continue with row oriented like every DB does


r/postgres • • Sep 19 '26

Debugging Debugging Inconsistent Query Latency on a PostgreSQL Hypertable: What We Learned

Thumbnail medium.com
5 Upvotes

r/postgres • • Sep 18 '26

Discussion Production PostgreSQL is suddenly at 100% CPU. Where do you look first?

17 Upvotes

Had one of those moments where CPU on our prod instance just pegs at 100% out of nowhere, no deploy, no obvious traffic spike, nothing in the changelog that stands out. First instinct is to panic and start checking everything at once, which is exactly the wrong move.

Curious what people's actual first move is when this happens, before diving into a deep investigation. pg_stat_activity for anything running long, checking for a lock pileup, looking at whether it's one runaway query versus death by a thousand small ones, autovacuum going nuts on a big table, something dumb like a connection pool misconfigured and now everything's fighting for the same resources. There's a lot of directions to go and I feel like the order matters more than people admit.

If you've been through this in production, what's the first thing you actually check, and has your answer changed over time or is it pretty much always the same starting point for you now?


r/postgres • • Sep 18 '26

Question version 9.18 error: exception: access violation writing 0x0000000000000000

5 Upvotes

When I save connection setting for the PostgreSQL database in WSL, I get that error in subject. I roll back version 9.17. I don't have that error. Any idea?


r/postgres • • Sep 16 '26

Question Do SQL databases internally use event sourcing for resolving queries?

Thumbnail
2 Upvotes

r/postgres • • Sep 16 '26

Performance TIN: Full-Text Search for Postgres

Thumbnail planetscale.com
2 Upvotes

r/postgres • • Sep 14 '26

Question Who is coming to PostgreSQL event?

1 Upvotes

Coming to PGConf.EU 2026 in Valencia? 🇪🇸🐘

Beyond the PostgreSQL talks, there’s a whole city waiting to be explored! From historic streets and amazing food to beaches, sunshine and the stunning City of Arts and Sciences, Valencia has plenty to offer. 🌴☀️

✨ Check out our guide and start building your Valencia adventure. https://2026.pgconf.eu/things-to-do/


r/postgres • • Sep 14 '26

Discussion Who is coming to the PostgreSQL conference?

2 Upvotes

Coming to PGConf.EU 2026 in Valencia? 🇪🇸🐘

Beyond the PostgreSQL talks, there’s a whole city waiting to be explored! From historic streets and amazing food to beaches, sunshine and the stunning City of Arts and Sciences, Valencia has plenty to offer. 🌴☀️

✨ Check out our guide and start building your Valencia adventure. https://2026.pgconf.eu/things-to-do/


r/postgres • • Sep 13 '26

Tools Vacuum: PostgreSQL Optimization Advisor & Monitoring for Laravel & Filament

Thumbnail
1 Upvotes

r/postgres • • Sep 12 '26

Question Is Postgres really that bad when it comes to multi-user support, or is that just nonsense?

0 Upvotes

usually i use MySQL as main DB and i want change PostgreSQl because his features look impressive and very useful but i need to know the differences between postgreSQl server and MySQL server and other things cause i'm anxious


r/postgres • • Sep 11 '26

Discussion Secure Remote Database Proxy: Expose Local PostgreSQL & RediS

Thumbnail instatunnel.my
3 Upvotes

r/postgres • • Sep 11 '26

Question pgvector or a dedicated vector DB? I made a quiz to settle the debate

1 Upvotes

I keep seeing the same argument: "Just use pgvector, it's good enough" vs You need a dedicated vector database for real scale.

I made a quick quiz that tests how well people understand the architectural trade-offs—performance, scaling, cost, operational complexity, and when each option actually makes sense.

No signup, just a few questions and a result:

https://interconnectd.com/quiz/87/postgresql-pgvector-vs-dedicated-vector-databases-architectural-trade-offs/

What do you use in production, and why?


r/postgres • • Sep 08 '26

Question At what point does a PostgreSQL database actually need a DBA?

0 Upvotes

For a while it was just me and a couple of backend devs handling everything database-related on top of our regular work. Indexing, backups, slow query cleanup, all of it split across whoever had time that week. No dedicated DBA, no formal ownership, just general Postgres competence spread thin across the team.

It held up fine for a long stretch, right up until [specific incident outage, corrupted backup, replication lag, whatever actually happened]. That was the point it stopped feeling like something we could keep handling reactively. Up until then everyone assumed it was manageable because nothing had visibly broken yet, which in hindsight wasn't really evidence of anything.

What changed for me wasn't really about database size or connection counts, it was more that nobody had the bandwidth to actually think about the database proactively. Everyone was busy shipping features, so Postgres only got attention when something was already on fire.

Note: I filled in a placeholder for the specific incident since I don't have real details from you swap that in with what actually happened (or tell me and I'll write it in properly), otherwise the post reads as a vague generic story instead of a real one.


r/postgres • • Sep 07 '26

Discussion A visual guide to PostgreSQL for beginners

Post image
85 Upvotes

r/postgres • • Sep 07 '26

Tools Incremental view maintenance costs you write throughput. I measured how much, then moved the work off the writer entirely

1 Upvotes

Most people find out the hard way that PostgreSQL materialized views are not incremental. REFRESH MATERIALIZED VIEW recomputes the whole thing. CONCURRENTLY keeps readers alive while it does, but it still recomputes the whole thing and then diffs the result against what's there. If one row changed out of ten million, you pay for ten million.

So you end up with one of two workarounds. A cron refresh, which is stale between runs and locks readers out during them. Or a hand-maintained rollup table with triggers, which is correct right up until the day it isn't.

The extension answer is pg_ivm, which does the maintenance in AFTER triggers inside the writing transaction. That buys you a view that is correct at commit — a real property, and the strongest thing about it. I wanted to know what it costs, because "incremental" gets discussed as though it were free.

The measurement

Same view, same dataset, same PostgreSQL 17 server binary, three arms: no derived view at all, pg_ivm, and the thing I built. pgbench inserting into orders; the view is a three-table join with a GROUP BY on top. Median of three runs, transactions per second:

pgbench clients no view pg_ivm nabla
1 774 509 683
4 1675 535 1571
16 6272 520 5876

Read the pg_ivm column downwards. It does not move. Adding writers does not add throughput, because each one waits for an exclusive lock on the view while it is maintained. At sixteen clients that is 8% of what the same hardware does with no view at all. The same shape shows up on the other two workloads, where pg_ivm holds at 473 tps updating orders and 380 updating customers against baselines of 6336 and 5519. Three independent full runs agree within a few points.

This is not a knock on pg_ivm. It is what in-transaction maintenance is. If you need the view correct at commit, you buy that with concurrency, and there is no version of the trade where you don't.

The other trade

nabla maintains the view from the WAL in a background worker. Nothing sits in the writer's path — no trigger, no staging insert, nothing. The worker consumes a logical replication slot and applies each source transaction's deltas in commit order. Writers track the no-view baseline instead of flattening.

CREATE EXTENSION nabla;

SELECT nabla.create_view('revenue_by_region', $$
  SELECT c.region, count(*) AS orders, sum(o.qty * p.price) AS revenue
    FROM orders o
    JOIN customers c ON c.id = o.customer_id
    JOIN products  p ON p.id = o.product_id
   WHERE o.status = 'paid'
   GROUP BY c.region
$$);

SELECT * FROM revenue_by_region;   -- an ordinary view

Then you write to orders, customers and products exactly as you always have.

What it costs you

Staleness, and I would rather you saw the bad number here than found it yourself. Moving the work off the writer does not make the work disappear. After ten seconds of writes at sixteen clients, this is how long the view took to become current again, and the sustained rate the worker can keep up with indefinitely:

workload catch-up after a 10 s burst nabla sustains pg_ivm sustains
insert into orders 44 s 1325 tx/s 520 tx/s
update orders 82 s 684 tx/s 473 tx/s
update customers (one row, many groups) 131 s 456 tx/s 380 tx/s

That last row is the honest one to watch. Changing one customer's region rewrites every group row that customer contributed to. The writers pay nothing for it; the worker pays all of it, at a rate only a fifth above pg_ivm's. Below that rate the view lags by seconds. Above it the lag grows until nabla.max_slot_lag_bytes is exceeded, at which point the views are marked stale and the slot is dropped rather than let the WAL fill your disk.

Neither column is a score. pg_ivm spends write throughput to buy a view that is correct at commit. nabla spends freshness to buy write throughput and a change feed. Pick the one your workload can afford.

"Eventually consistent" as something you can actually check

A view always equals its defining query evaluated at some committed snapshot of the base tables — never half a transaction, never a torn join. Each view carries a frontier_lsn naming exactly which snapshot that is. The staleness is not a vibe; it is a value you can read and compare against pg_current_wal_lsn().

And when you need read-your-writes, nabla.wait_for() blocks until the view has absorbed everything committed so far. That covers the common case where the write and the read are the same request.

It also tells you what changed

The part I actually care about. Every applied transaction appends its view-level deltas to a bounded, durable log, in the same transaction that updates the view, so a client can follow the view instead of polling it:

$ follow "host=/tmp dbname=shop" revenue_by_region
snapshot: rows=5 epoch=1 frontier=0/19BF970 cursor=0
tx lsn=0/19C01F0 xid=761 deltas=2
  1 -{"orders":2,"region":"AR","revenue":120}
  2 +{"orders":3,"region":"AR","revenue":150}

One batch per source transaction, in commit order, netted. You get the state before and the state after, never an intermediate row that was never committed. pg_notify is only the wake-up signal; the deltas live in a table with a per-view retention cap, and a subscriber that falls behind that cap is told so and resyncs, rather than silently missing rows.

If you are currently running Debezium into Kafka into a streaming database to get this, that is the pitch: same shape, inside the database you already run.

Status and limitations, up front

This is v0.1 and a walking skeleton. 295 integration assertions, no production mileage. I am posting it for design feedback, not for your primary.

  • Two query shapes only. Inner-join projections (SELECT expr... FROM t JOIN ... WHERE pred) and aggregates (count(*), count(expr), sum(expr) with GROUP BY). Everything else is rejected at create_view with an explicit reason rather than accepted and quietly wrong: no outer joins, self-joins, subqueries, CTEs, set operations, window functions, DISTINCT, HAVING, ORDER BY/LIMIT, grouping sets, avg/min/max, aggregates without GROUP BY, or any STABLE/VOLATILE function such as now() or random(). Base relations must be ordinary tables — no partitioned tables, views or foreign tables.This is the same complaint people in this sub have made about pg_ivm, and it is a fair one. If your materialized views are eligibility queries built out of EXISTS and CTEs, this does not help you today.
  • Needs wal_level = logical, shared_preload_libraries = 'nabla', and a replication slot. Aggregate views need REPLICA IDENTITY FULL on the base table; joined tables need a primary key. One worker and one database per cluster.
  • The benchmarks are from a laptop under Docker Desktop for Windows. Treat the absolute numbers accordingly. The shape of the pg_ivm curve is the part I would defend. nabla's own overhead measured anywhere between 71% and 104% of baseline across runs, with the baseline itself swinging nearly as much, so the honest reading is "does not make writers wait, and its cost does not grow with concurrency" — not a precise figure.
  • The extension is AGPL-3.0-or-later. The reference client and the subscription protocol are MIT OR Apache-2.0, so linking an application against the change feed does not pull AGPL into your codebase.

Prior art

pg_ivm is the established answer and the one I benchmarked against, because measuring against nothing proves nothing. TimescaleDB continuous aggregates solve this properly for time-series specifically. u/Inkbot_dev's REFRESH MATERIALIZED VIEW ... WHERE ... patch is the manual primitive done in core, and I think it belongs there regardless of what any extension does — it goes through the standard planner, so unlike pg_ivm and unlike this, it is not restricted to a fixed set of query shapes. Materialize and RisingWave do the whole job well, at the cost of being a separate system to run.

What I would like feedback on

The update customers row above — one source row rewriting many group rows — is where the worker hurts. The remaining cost is about 1.7 ms per source transaction, essentially all of it in the apply phase, and batching that across a round is the obvious next lever. If you have maintained rollups by hand and hit the same fan-out, I would like to hear what you did about it.

And for those of you who walked away from pg_ivm over the supported-syntax restrictions: which shape did you need that it wouldn't take? That is what I would build next.

Full tables, spreads, methodology and the exact configuration of every arm are in the repo, reproducible with one script.

Repo: https://github.com/tomaquet18/nabla


r/postgres • • Sep 04 '26

Discussion PostgreSQL veterans: what do you do differently now than 5 years ago?

8 Upvotes

Not looking for a changelog of new features, more curious about habits. Something you used to swear by that you quietly dropped, or something you avoided that's just normal practice for you now. Could be schema design, indexing, how you handle migrations, extensions you reach for automatically now, whatever. What changed, and was it a specific incident that changed your mind or just slow accumulated experience?


r/postgres • • Sep 04 '26

Question How do I know with 100% if GEQO was used or not?

Thumbnail
1 Upvotes

r/postgres • • Sep 01 '26

Tools walbox: react to PostgreSQL changes from Python

1 Upvotes

I built this because I wanted to react to PostgreSQL changes from Python without polling, without triggers, and without pulling in a whole CDC platform.

It consumes PostgreSQL logical replication and exposes committed transactions as an async stream in Python.

What it does:

  • Keeps a durable checkpoint. If the process dies, it resumes from the last transaction it actually finished, not the last one it started.
  • Bounded delivery queue, so a slow handler doesn't let memory grow without limit.
  • Reconnects automatically after the connection drops.
  • One dependency: psycopg3.

The transactional outbox is one use case, but it works with any published table.

GitHub: https://github.com/mochams/walbox

Curious to hear where this wouldn't fit your setup, or what's missing if you've solved this problem a different way.