Questions tagged [postgresql-10]
for PostgreSQL questions specific to version 10
635
questions
0
votes
0
answers
58
views
Cannot start PostgreSQL database: Invalid primary and secondary checkpoints
My specific problem is that we are unable to restart our postgreSQL database.
We have an ubuntu server (release 18.04) with PostgreSQL 10 installed. I commonly revise my IP address in the pg_hba.conf ...
0
votes
0
answers
18
views
Addressing Orphaned Rows During PostgreSQL Data Migration
Version - PostgreSQL 10.21, compiled by Visual C++ build 1800, 64-bit
Platform - Windows
When migrating data from PostgreSQL 10.21 to 14.7, during the dump process, we encountered an issue with ...
0
votes
0
answers
22
views
Addressing Table Corruption Issues Arising from Abrupt Server Shutdown During PostgreSQL 10.20 to 14.7 Migration
During the PostgreSQL migration from version 10.21 to 14.7, we encountered an issue caused by corruption in a specific table. Upon checking the logs, we noticed numerous instances of the server ...
0
votes
0
answers
24
views
Count Mismatch Challenges During PostgreSQL Database Migration: Causes and Solutions
Version - PostgreSQL 10.20, compiled by Visual C++ build 1800, 64-bit
Platform - Windows
Regarding PostgreSQL, during the migration from PG 10.20 to 14.7, we will perform a sanity check on the ...
0
votes
1
answer
53
views
Unable to use index in specific situations
I am facing a strange and infuriating problem of my PostgreSQL 10 database not using indexes in specific situations. I have created an index of an md5 hash of one of the columns, and this index seems ...
0
votes
1
answer
135
views
How to handle invalid token "False" in postgresql
select replace(pol.bundle_product, '''', '"')::json ->> 'display_name' from pos_order_line pol where order_id in ('164568','140750');
i will query json data in postgresql but it shows ...
0
votes
1
answer
101
views
How to update all table in postgreSQL
I'm starting with postgreSQL and NodeJS and I have a table of office objects with the fields object_id(PK), inventory(varchar), area(FK) and description(text). This table must be updated weekly. How ...
1
vote
0
answers
34
views
Postgres, create index for WHERE ... OR .. case without rebuilding a query
I have a query(Posgres) that looks like this (I replaced fields with * meaning that fields could vary):
SELECT *
FROM actions
WHERE
(logs."group"=$1 OR logs."team" IN ($2))
and ...
0
votes
0
answers
160
views
Upgrading PostgreSQL to 15.3 with old data
I'm running Postgres 10.4 in the docker container for [Posit Connect (https://posit.co/products/enterprise/connect/) application. The latest version of Posit Connect requires Postgres 15.3.
When I ...
0
votes
0
answers
125
views
How to change correctly postgresql 'datestyle' parameter in docker-compose.yml?
How to change correctly postgresql 'datestyle' parameter in docker-compose.yml?
In container from image in /var/lib/postgresql/data/postgresql.conf the defulat is datestyle = 'iso, mdy', i want to ...
0
votes
1
answer
75
views
change in behavior declaring index on timestamp column
I am hitting a problem with index creation across different versions of Postgres. We are upgrading a Postgres database from 10.21 to 14.4. In preparation for this, I've been running our tests on the ...
0
votes
0
answers
30
views
Can I extend PostgreSQL (v10) tabelspace to multiple locations (file systems)?
The file system where the tablespace resides on reaches it's max size. I would like to extend the tablespace to another file system but I can't find any document to support that. Can PostgreSQL (v10)...
1
vote
1
answer
54
views
How can I fetch the first 7 days with scheduled lessons for a user in the future using a SQL query?
I have a database table as follows:
id
lesson_start
lesson_end
instructor_id
student_id
1
2023-06-01 04:00:00.000000
2023-06-01 06:00:00.000000
3
4
2
2023-03-18 11:00:00.000000
2023-03-18 12:30:00....
1
vote
1
answer
570
views
Why does `date_trunc('day', current_date) + interval '1 day' - interval '1 second'` cause query to hang?
When I set up a date range using max(lasttime) for the upper bound, the query works.
range_values as (
select date_trunc('month', current_date) as minval,
max(lasttime) as maxval
from ...
0
votes
0
answers
153
views
Memory continuously increases at a constant rate in Azure Database for PostgreSQL single server
Our memory usage increases at a constant rate.This is observed in Azure Metrics.
Two questions here:
Is there a way to know which process is generating the higher and higher memory consumption?
Any ...
0
votes
0
answers
48
views
Is possible to create a "demi/sub"-superuser in Postgres (10)?
I want to create a "demi/sub" super user, which can perform duties as admin user, but shouldn't be able to delete or create Dbs, alter system, but must have all privileges except delete on ...
0
votes
2
answers
118
views
How do I optimize a view for querying a ledger-like table in PostgreSQL?
I have a ledger-like table in a postgresql DB that tracks events for film comparisons on a site where users can add/remove film comparisons. Each event is recorded as a timestamped row in the event ...
0
votes
1
answer
417
views
Bitmap heap scan slow with same condition as index scan
I have a query with joins to rather large tables, but do not understand the slow performance of it.
Especially this part of the query plan seems weird to me (complete plan and query below):
-> ...
3
votes
1
answer
411
views
node.js | Replacing DB client with Prisma keeping preserving DB structure - issue with uuid_generate_v4()
I am trying to add the Prisma DB client to the existing node.js project while preserving the DB structure.
Postgresql
Prisma 4.7.1
I've set up the initial Prisma configuration (env vars, etc.).
I've ...
0
votes
1
answer
268
views
Postgres COLLATION FOR
I have tried the function collation for(argument) which is described in the PostgreSQL documentation. But when I try to execute the query which is given in the same PostgreSQL documentation, I get an ...
0
votes
0
answers
45
views
Is there any solution for error problems when uploading csv file like this one I experienced?
So I already write code like this :
-- SCHEMA: Portofolio2
-- DROP SCHEMA IF EXISTS "Portofolio2" ;
CREATE SCHEMA IF NOT EXISTS "Portofolio2"
AUTHORIZATION postgres;
-- ...
0
votes
0
answers
61
views
Cannot upgrade extension postgres_fdw, due to: has no update path from version "1.0" to version "1.1"
I am trying to upgrade My postgres DBs from postgres 10 to 14, after looking at the extension version here https://docs.aws.amazon.com/AmazonRDS/latest/PostgreSQLReleaseNotes/postgresql-extensions....
0
votes
0
answers
192
views
pg dump with folder format fails for large database with error : no space left on the device
We are running postgresql database server running as docker container inside a VM. Postgresql docker image version is 10. Server size is 32 cpus and 256 GB memory.
VM Specs : Ubuntu 18.04, Docker ...
0
votes
1
answer
111
views
How to get the count of the modal value in PostgreSQL?
I have calculated the modal value of a column in a JOIN.
mode() WITHIN GROUP (ORDER BY col) AS modal_col
I would also like the frequency of the modal value. i.e. how often does this value appear?
I ...
0
votes
0
answers
46
views
String equals "=" on a varchar column breaks after upgrade from Postgres 10.20 to 10.22
Yesterday I upgraded our Postgres DB from 10.20 to 10.22. I'm using Docker to run the DB, so I just updated the Docker config to run the newer version and kept the same data folder. As far as I know, ...
0
votes
0
answers
120
views
PostgreSQL: Matching integer ids in where clause (apparently) fails
I do not understand the behaviour of the following query:
SELECT qs.id_gen::int as qs_i
, fi.id_gen::int as fi_i
, ABS(qs.id_gen::int - fi.id_gen::...
0
votes
0
answers
40
views
PostgresSQL - Want a tag_count from tags saved in arrays
I have a posts table in which tags are saved in arrays
CREATE TABLE public.posts
(
post_id uuid NOT NULL DEFAULT uuid_generate_v4(),
post_text text COLLATE pg_catalog."default" NOT ...
3
votes
3
answers
480
views
Postgres query planner won't use less expensive composite index
We've run into a strange issue with Postgres, initially unearthed as we prepare to upgrade from 10.21 to 11+. What we'd initially thought was a performance regression in newer versions of Postgres ...
0
votes
1
answer
189
views
Postgres recovery_min_apply_delay metric
We have delayed replicas (2h for example) and prometheus monitoring.
Prometheus do the query to get replication lag:
SELECT CASE WHEN NOT pg_is_in_recovery() THEN 0 ELSE GREATEST (0, EXTRACT(EPOCH ...
0
votes
1
answer
197
views
Query optimization on a huge table
I have a table that have at least 3 columns :
id, type : uuid, primary key
number : smallint, can't be null
end : timestamptz, can't be null
I am using this query :
SELECT
number AS key,
MAX(...
0
votes
1
answer
469
views
PostgreSQL Checkpoint Discrepancy
There is problem about that I don' t understand in a database. Our configuration is like following:
archive_mode = on
archive_timeout = 900
checkpoint_timeout = 60min
checkpoint_completion_target = 0....
1
vote
1
answer
434
views
DC-DR Sync issue in Patroni PostgreSQL setup
We have a 3 instance cluster in DC and a 3 instance cluster in DR as standby_cluster. For DC-DR real-time sync, we have added the DC cluster's leader's IP as standby_cluster IP in the DR patroni ...
1
vote
0
answers
492
views
How to prevent special characters from being corrupted when using UTF8 encoding in Postgres?
I'm using PostgreSQL DB with UTF8 encoding and I'm trying to fetch some data using psql.exe.
My table diacritics contains the following data:
id
name
1
Kočička
2
Mňau
As you can see, there are a ...
3
votes
1
answer
245
views
How to optimize fuzzy string matching pairs of phrases (intersection names) in PostgreSQL
We have a table of intersection names like 'Main St / Broadway Ave' and we are trying to match potentially messy user input (of the form (street1, street2)) to these names. There's no guarantee the ...
1
vote
1
answer
986
views
How to migrate a PostgreSQL 10 database from Windows C drive to another drive
I have almost an identical problem as this post:
How to migrate a Windows 10 installation of PostgreSQL 9.5.7 to a larger disk
I have a PostgreSQL database on my C drive which is running out of space. ...
0
votes
0
answers
296
views
Unable to specify foreign key in managed model to non-managed model (Django 3.2.7 / Postgresql 10.18)
I am implementing a "profile model" in Django 3 that at its simplest is a two field model: a one-to-one relationship field to the default Django User model and a foreign key relationship to ...
0
votes
0
answers
413
views
Can WAL replications cause locks?
Running, under version 10, a setup of 1 master and 3 physcal replicas with their corresponding replication slots.
A stubborn provider that manages our ERP is becoming quite annoying assuring that the ...
0
votes
1
answer
328
views
Postgres get the next row with bigger value (coparing different columns)
Postgres version: 10
Table example:
CREATE TABLE log (
group_id INTEGER,
log_begin TIMESTAMP,
log_end TIMESTAMP
);
My goal: I want to know, for distinct groups, which log began right ...
1
vote
0
answers
388
views
Postgres upsert
I am trying to do update my database tables via upserts from a postgres-to-postgres foreign data wrapper.
I have two code snippets below. The first is using the constraint on the primary key and the ...
0
votes
1
answer
126
views
Postgres 13.6 is using Sequential scan and Postgres 10.18 is using Index Only Scan
We have upgraded our db from version 10.18 to 13.6 and for simple count select I have noticed a different behaviour.
Postgres 13.6:
explain select count(id) from jobs;
...
2
votes
0
answers
485
views
No data available in performance insight
I have a critical application deployed in AWS RDS; the DB engine is PostgreSQL version 10.18. The architecture is unusual, because we're talking about medical data. This means that all the doctors ...
0
votes
0
answers
2k
views
Postgresql fatal the database system is starting up
I have a PostgreSQL database which I tried to start in two different machines (same OS version windows 10) without installing. It is started in one machine without issues (immediately started) but ...
3
votes
1
answer
7k
views
PostgreSQL idle_in_transaction_session_timeout seems to have no effect
I'm working with a PostgreSQL server version 10.5 (can't upgrade it at the moment) running in Docker. XL Deploy is connected to it and I upload a new archive that is 232MB. I get the error FATAL: ...
1
vote
0
answers
215
views
How to programmatically collect Postgres query performance metrics
Problem statement
I have two databases provisioned via Heroku’s PostgreSQL database-as-a-service add-on. These databases are running PostgreSQL 10.19. Heroku is deprecating PostgreSQL 10 later this ...
1
vote
0
answers
193
views
Discrepancy between two (seemingly) identical cache-hit-ratio queries
I'm trying to assess the performance of a Postgres 10.6 instance. The first query below returns 0.88, the second one 0.77. Whence the discrepancy between these two queries for the cache hit-ratio?
...
0
votes
1
answer
179
views
Joining more than 2 tables for reports in django and extract all the fields from the joined table
I am joining the ClientDetails, AssignmentTable and CallDetails table to get a view as to which telecaller a particular client has been assigned to and get the latest call details as well. However I ...
0
votes
0
answers
85
views
Transforming wildcard user input to tsquery
We have a search input field on our website. We would like to support the following 4 wildcards:
1) find results that contain at least one of the two words:
tree apple
2) find results that contain ...
0
votes
1
answer
132
views
Issues with calculating average age but getting incorrect results in postgres
I am getting the average age of an account. to do so I have employed the following code.
select
m."storeId", s."locationName",
COUNT(m."membershipEnded" is not null) ...
0
votes
1
answer
542
views
Calling a stored function that returns nothing
I have this function which only inserts some data and returns nothing
CREATE OR REPLACE FUNCTION test(srcDc integer, targetDc integer)
RETURNS void AS
$BODY$
BEGIN
INSERT INTO configurable_code(...
0
votes
2
answers
990
views
Postgresql replace an array of ids in jsonb with more columns
Given a jsonb value in the source table like :
SOURCE_TABLE
id | jsonb
---+------
1 | {"col_1": "A", "col_2": ["A", "B", "C"], "col_3&...