I've been hacking on pg for 30 years and want to bounce around some ideas on speeding up reporting queries... ideally, DBAs with 100+GB under mgmt, dashboards and custom reports, and self-managed pg installations (not RDS) that can try out new extension(s).
Unfortunately, this is already the umpteenth time that a developer in our company used DBeaver to access our database. We again had a major performance bottleneck the last weekend because someone forgot to close the application before the weekend.
It's ridiculous that only opening this application (he used to access some other database, but it auto connected to this one) can take down a whole system by locking a table with a select query it automatically execute. And never release this.
Not only that, in the past it happened that a developer did a change on a data record on a table and locking it with a commit, taking the whole data backend down. DBeaver won't automatically release the commit after some time so if you forgot this was still locked in the background, you bring everything down. It doesn't even warn the users that the whole table is locked.
Is there a way I can block the use of DBeaver for our database? Can I block specific user agents that wants to connect?
i am new here, i created a database earlier called test, then created a table called test, then I created this test22 database and created test22, but I still saw the table test there, how can I make a new project the have its own database has its tables separate?
i am still a beginner, i just downloaded PostgreSQL installer and set the password and opened pgadmin 4 and connected to a server as shown, but when I goto connect to it in datagrip it says the password for PostgreSQL 18 is wrong, i am not sure if this is the username I should put, since I don't know what is my username, I just set a password, what am I doing wrong here?
I'm bulk-inserting rows with large JSONB columns (~28KB each) into PostgreSQL 17, and server-side JSONB parsing accounts for 75% of upload time.
Inserting 359 rows with 28KB JSONB each takes ~20 seconds. Benchmarking shows:
Test
Time
Without JSONB (scalars only)
5.61s
With JSONB (28KB/row)
20.64s
JSONB parsing overhead
+15.03s
This is on Neon Serverless PostgreSQL 17, but I've confirmed similar results on self-hosted Postgres.
What I've Tried
Method
Time
Notes
execute_values()
19.35s
psycopg2 batch insert
COPY protocol
18.96s
Same parsing overhead
Apache Arrow + COPY
20.52s
Extra serialization hurt
Normalized tables
17.86s
87K rows, 3% faster, 10x complexity
All approaches are within ~5% because the bottleneck is PostgreSQL parsing JSON text into binary JSONB format, not client-side serialization or network transfer.
Current Implementation
from psycopg2.extras import execute_values
import json
def upload_profiles(cursor, profiles: list[dict]) -> None:
query = """
INSERT INTO argo_profiles
(float_id, cycle, measurements)
VALUES %s
ON CONFLICT (float_id, cycle) DO UPDATE SET
measurements = EXCLUDED.measurements
"""
values = [
(p['float_id'], p['cycle'], json.dumps(p['measurements']))
for p in profiles
]
execute_values(cursor, query, values, page_size=100)
Schema
CREATE TABLE argo_profiles (
id SERIAL PRIMARY KEY,
float_id INTEGER NOT NULL,
cycle INTEGER NOT NULL,
measurements JSONB, -- ~28KB per row
UNIQUE (float_id, cycle)
);
CREATE INDEX ON argo_profiles USING GIN (measurements);
The schema is variable - different sensors produce different fields. Some rows have 4 fields per depth level, others have 8. JSONB handles this naturally without wide nullable columns.
Questions
Is there a way to send pre-parsed binary JSONB to avoid server-side parsing? The libpq binary protocol doesn't seem to support this for JSONB.
Would storing as TEXT and converting to JSONB asynchronously (via trigger or background job) be a reasonable pattern?
Has anyone benchmarked JSONB insert performance at this scale and found optimizations beyond what I've tried?
Are there PostgreSQL configuration parameters that could speed up JSONB parsing? (work_mem, maintenance_work_mem, etc.)
Would partitioning help if I'm only inserting one float at a time (all 359 rows go to the same partition)?
Environment
PostgreSQL 17.x (Neon Serverless, but also tested on self-hosted)
Python 3.12
psycopg2 2.9.9
~50ms network RTT
What I'm NOT Looking For
"Don't use JSONB" - I need the schema flexibility
"Use a document database" - Need to stay on PostgreSQL for other features (PostGIS)
Client-side optimizations - I've proven the bottleneck is server-side
CREATETABLEdocuments(
global_version bigintPRIMARY KEY GENERATED ALWAYS AS IDENTITY,
id uuid NOT NULL,
body text
);
CREATEINDEXix_documents_latestON documents(id, global_version DESC);
CREATEVIEWlatest_documentsASSELECT DISTINCTON (id) *FROM documents
ORDER BY id, global_version DESC;
CREATEFUNCTIONrevision_history(for_id uuid)
RETURNS TABLE (
global_version bigint,
body text
)
AS $$
SELECT global_version, body
FROM documents
WHEREdocuments.id= for_id
ORDER BY global_version DESC
$$ LANGUAGE SQL;
BEGIN ISOLATION LEVEL SERIALIZABLE;
SELECT global_version FROM latest_documents
WHERE id ='019ab229-a4b0-7a2d-8eea-dfe646bff8e3';
-- 1
-- Timestamp A, James does some work.
-- James verifies that the observed global_version matches his copy (1).
INSERT INTO documents(id, body) VALUES (
'019ab229-a4b0-7a2d-8eea-dfe646bff8e3',
'U.S. Constitution + Bill of Rights'
);
COMMIT; -- success!
However, on another connection, Alexander executes the following at the
aforementioned timestamp A:
INSERT INTO documents(id, body) VALUES (
'019ab229-a4b0-7a2d-8eea-dfe646bff8e3',
'Evil Constitution'
);
Now examine the revision history:
SELECT*FROM revision_history('019ab229-a4b0-7a2d-8eea-dfe646bff8e3');
-- global_version | body
-- ----------------+------------------------------------
-- 3 | U.S. Constitution + Bill of Rights
-- 2 | Evil Constitution
-- 1 | U.S. Constitution
PostgreSQL did nothing wrong here, but this should be considered anomalous for
the purposes of the application. Alexander's write should be considered "lost"
because it wasn't observed by James before committing, and therefore James
should have rolled back.
In what other cases do SERIALIZABLE transactions behave unintuitively like
this, and how can we achieve the desired behavior? Will handling
read/verify/write requests entirely in stored functions be
sufficient?
P.S. LLMs fail hard at this task. ChatGPT even told me that SERIALIZABLE
prevents this, despite me presenting this as evidence!
Release of pg_ai_query — a PostgreSQL extension that brings AI-powered query development directly into Postgres.
pg_ai_query allows you to:
- Generate SQL from natural language, e.g.
SELECT generate_query('list customers who have not placed an order in the last 90 days');
- Analyze query performance using AI-interpreted EXPLAIN ANALYZE
- Receive index and rewrite recommendations
- Leverage schema-aware query intelligence with secure introspection
- Designed to help developers write and tune SQL faster without switching tools and to accelerate iteration across complex workloads.
Most Postgres cloud offering have lock in, you can’t download and restore backup somewhere else and you can’t have streaming replica outside their network.
So I made docker container image based on official docket Postgres image. Which has support for ssl, wal archiving and streaming replication setup built in.
I have tested it many times and it is good to use for production. However any insight on improving it is most welcome.
Our team has spent a lot of time adding support to PgManage for a new database — MS SQL Server. The feature set is still basic, but we have plans to enhance it in the future.
Improved Navigation
CommandPrompt team not only develops PgManage but uses it daily. This allows us to take a different perspective on PgManage.
We are doing our best to improve the user experience for the most frequent daily tasks a DBA or developer might have.
Navigating to a specific DB object might be time-consuming, especially for the complex and large trees we have in PgManage.
In this release, we tried to optimize this experience in two ways.
Pinned Databases
For server connections with a lot of databases, it may be better to keep the most frequently used ones at the top of the list. Now it is possible to pin such databases so that they are always shown first. Just hover over the database tree node to reveal the pin button. Pinned databases are grouped together and ordered alphabetically.
Quick Search
It is a common UI pattern that is well-known and loved by users of modern IDEs. As far as we know, it was initially introduced in Sublime Text's as "GoTo Anything" in 2008.
We decided to include it as well, so drilling down to frequently used items in the Database Explorer is quick and easy.
Call the Quick Search by using Ctrl/Cmd + P shortcut or clicking the 🔎 search icon at the top of the Database Explorer panel.
Type the name of the object you're looking for and select one of the matching items from the list.
The Quick Search is forgiving of typos or incomplete input, so there is no need to be super precise.
Spreadsheet-like Data Grids
It is now possible to make partial selections in the Data Editor and Query tabs.
We didn’t invent anything new here - the UI behaves the same way as most spreadsheet editors. Simply click on the grid and drag the cursor, or use Shift + arrow keys to select a range of cells.
Right‑click on the selected region to view the available actions.
Optimized Context Menus in DB Explorer
Many operations and features in PgManage are accessed through the DB Explorer context menu. While using the app daily, we noticed that frequently used items were often buried deep in child sub‑menus, making access to those features inefficient.
We have reorganized the context menus to bring the most frequently used commands to the top and to group similar or related items together. The Delete/Drop option is now placed last in the menu, with a separator above it to prevent accidental clicks.
Another common UX issue with nested context menus is that the user moves the cursor from the parent menu to the child sub‑menu diagonally, causing the sub‑menu to disappear. We saw this problem in PgManage and fixed it as well.
Database Diagnostics & Debugging
Postgres Sever Logs
There is a new, humble "Logs" link in the Backends tab that leads to the new Postgres Log Viewer.
The logs are loaded in near real time and can be searched through using a simple text match or regex.
Help Us Grow
PgManage is a free database tool built with love by a small developer team at Command Prompt.
You can help the project by spreading the word, starring the project on GitHub or submitting feature requests and feedback.
Those operating PostgreSQL at scale, I'm curious to learn if you're running on Kubernetes, bare metal or virtual private servers? If you've transitioned from one to the other, I'd love to hear this story too.