Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security DownloadsGitHub Release: openclaw/openclaw v2026.7.35 (20.09.2026)(20.09.2026 um 21:37 Uhr)
IT Security DownloadsGitHub Release: openclaw/openclaw v2026.7.35 (20.09.2026)(20.09.2026 um 21:37 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Losing PostgreSQL Gains? Blame Inline JSONB!!

Reagiere als Erste:r — dein Feedback zählt!

Losing PostgreSQL Gains? Blame Inline JSONB!!
PostgreSQL's jsonb is a favorite among developers for its flexibility - but it hides a dark side. When used carelessly, especially in-line within rows under 2KB, it can silently destroy performance, even if you're using indexes. Here's why.
🔍 The Hidden Cost of JSONB (Inline Storage)
PostgreSQL stores table rows in 8KB pages, packing as many tuples as possible. For a typical row with 10–12 columns, and small text/integers, 40–100 rows can easily fit per page.
Typically row count = Page Size(8kb) / row size + row metadata (30-50 bytes approx.)
But the game changes when you add jsonb.
Example
CREATE TABLE events (
id serial PRIMARY KEY,
user_id int,
action text,
metadata jsonb
);
Suppose metadata which is a jsonb column contains:
{
"ip": "127.0.0.1",
"device": "Android",
"country": "IN"
}
This JSON might be just 100–500 bytes, so PostgreSQL stores it in-line inside the same page (no TOASTing).
Result
Each row size jumps from ~80 bytes → ~200–400 bytes
Row count per page drops from 100 → 20–40
Index scan still needs to read each page for matching rows
More pages = more I/O, slower performance

🔢 Real Benchmark Insight
Performance comparisonEven with a GIN or B-tree index on the JSONB column, PostgreSQL still needs to scan all matching pages to retrieve the full tuple.
🧠 Why Index Doesn't Save You
Say you index a JSONB key like:
CREATE INDEX ON events ((metadata->>'ip'));
And query:
SELECT * FROM events WHERE metadata->>'ip' = '127.0.0.1';
PostgreSQL will:
Use the index to find matching tuples
Still need to fetch the row from disk
Because JSONB is in-line, many pages are touched
More page fetches = more IO = slower queries

🩹 What You Can Do
✅ Force TOAST: Add padding to make JSONB exceed 2KB:

UPDATE events SET metadata = metadata || jsonb_build_object('padding', repeat('x', 2000));
✅ Split into separate table: If JSONB is rarely queried
✅ Stick to well defined schema and avoid using jsonb unless absolutely necessary.

🧾 TL;DR
JSONB under ~2KB is stored inline
That bloats each row and reduces rows per page
More pages scanned = slower indexed reads
Even efficient indexes can't avoid this penalty
Force TOAST or redesign if performance matters

🔚 Final Thought
Indexes reduce logical lookup cost. But if rows are bloated due to in-line JSONB, you're paying a high physical I/O cost - and that's where PostgreSQL performance dies quietly.
📦 Source Code
You can find the source code and diagram files on GitLab:
👉 rohit yadav / Postgres-JsonB-Performance · GitLab

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Losing PostgreSQL Gains? Blame Inline JSONB!!

Thematisch verwandte Begriffe: Losing, PostgreSQL, Gains, Blame · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93956 | A flaw has been found in olivier-ls PHP-FTS up to 1.1.2. Affected by thi…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick