178,957 questions
Best practices
1
vote
3
replies
86
views
Want to write online service for board games as my diploma in University
I`m big fan of board games, and when professor ask what I want to write as a diploma, I make decision fast - service for online board games.
Now I have some questions, which I don't know how to ...
0
votes
0
answers
59
views
Query to get details of fragmented indexes in Postgresql
I am looking for query to get statistic of index fragmentation in Postgres. I know about pgstattuple but it performs live scan on index which is expensive and so I don't want to use it. I have found ...
3
votes
3
answers
132
views
Import large CSV files with many unknown column names and types (auto-detection)
Using PostgreSQL 18, I want to import a large .csv file with unknown column names and types. I have 2 related .csv files:
The 1st file contains around 100 columns and 2,000,000 rows of data, like ...
Advice
2
votes
9
replies
104
views
When to prefer application code for syncing denormalized columns over a trigger?
Take the example of SO: you have a votes table and a posts table. You want to keep in sync the vote count for each post but the votes table is the source of truth.
You can use statement level triggers ...
0
votes
1
answer
38
views
NextAuth PrismaAdapter linkAccount() hangs indefinitely on Vercel but works locally
Problem
I'm using NextAuth v4.24.13 with @auth/prisma-adapter for OAuth authentication. The login flow works perfectly in my local development
environment, but consistently hangs and times out on ...
Best practices
1
vote
9
replies
73
views
Relatedness table - more rows or more columns?
I'm creating a table to represent the degree of relatedness between a large group of tags. My app involves user-created entries which can have one or more tags, and for each pair of tags (there are ...
1
vote
0
answers
59
views
Restore PostGIS and ArcSDE objects from PostgreSQL 13 to Google Cloud SQL Postgres 17 [closed]
I am trying to restore a database backup from a self-hosted PostgreSQL 13 instance to Cloud SQL for PostgreSQL 17. The source database has the PostGIS extension with ArcSDE and custom data types and ...
1
vote
1
answer
62
views
Does slick-pg support this PostgreSQL feature?
Using the PostgreSQL-specific slick-pg extension of slick, which supports multi-upsert. Let's consider a small example.
CREATE TABLE foo (id INT PRIMARY KEY, name TEXT DEFAULT 'foo');
The ...
1
vote
0
answers
95
views
Pulling schema updates from Postgres
I have few node microservices connected to single postgres db. I also have an elixir service for realtime message passing between BE and FE.
I am now enhancing realtime service with some additional ...
-2
votes
0
answers
57
views
running the node micro services in local with DB postgres using docker [closed]
UPDATE 1:
I searched in the codebase and I am seeing in the below files, can you please let me know where to update, since I am a beginner not sure where to update the port 5432, providing the image ...
Best practices
2
votes
4
replies
124
views
What Considerations should I make with "SELECT ..." queries to avoid data changes
Relatively new to SQL and want to learn best practices for "safe" queries.
If I have queries like "SELECT {cols} FROM {table} WHERE {condition}" or SELECT {cols} FROM ...
0
votes
1
answer
132
views
Why is DELETE much slower than TRUNCATE even when deleting all rows from a table in PostgreSQL?
In an application cleanup job, I need to remove all rows from a table regularly.
Table:
CREATE TABLE session_logs (
id BIGSERIAL PRIMARY KEY,
session_id TEXT,
created_at TIMESTAMPTZ, ...
13
votes
3
answers
802
views
PostgreSQL prepared statement becomes slower after repeated executions because the optimal plan changes
I'm debugging a performance regression in an application that uses prepared statements against PostgreSQL 15.
I have a table with skewed data distribution:
CREATE TABLE invoice_events
(
id ...
Advice
0
votes
1
replies
55
views
CIS Postgres 15 Benchmarks - log_replication_commands
As an action of our last test my company implemented log_replication_commands to 'log all replication commands that are executed in your database cluster to ensure the data is not off-loaded to an ...
3
votes
1
answer
106
views
Advance `confirmed_flush_lsn` in PostgreSQL 18 without a heartbeat table when `pgoutput` skips empty transactions
After upgrading to PostgreSQL 18, pgoutput no longer sends BEGIN/COMMIT for transactions that touch only tables outside the publication. This is by design (see related question). Our replication slot'...