Questions tagged [postgresql-11]

PostgreSQL version 11

Filter by
Sorted by
Tagged with
0
votes
1answer
3 views

logical replication. How do I change the subscriber to new master?

I'm migrating Linux distros and need to migrate the Postgres 11 to new master. I can do a streaming replication and have little to no downtime or do a dump. That I got down. My problem is how do I ...
0
votes
2answers
38 views

PostgreSQL 11.9 Unable to restart the server with error -- pg_ctl: directory "/var/lib/postgresql/11/main" is not a database cluster directory

We have been trying hard to restart the DB cluster server which was shutdown after power failure. We have tried systemctl , pg_ctl and pg_ctlcluster commands but all the time we are getting same error....
0
votes
0answers
12 views

Bucardo Race Condition

I have an application that uses multiple PostgreSQL databases and Bucardo to sync between the various master/slave nodes. I'm seeing a race condition where bucardo dies on a master node and doesn't ...
1
vote
1answer
91 views

Why is my spatial query slower in Postgres 13 than in Postgres 11?

Postgres versions PostgreSQL 13.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.2.1_pre1) 10.2.1 20201203, 64-bit PostgreSQL 11.11 (Debian 11.11-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by ...
0
votes
0answers
10 views

A strange index that is always marked pg_index.indisvalid=false . Why indexes with ON ONLY option are always rebuilt in invalid state?

I'm looking in database (postresql 11.10) and see an index on a partitioned table that marked as invalid: SELECT indrelid::regclass, indexrelid::regclass, indisvalid, ddlx_create_index(...
1
vote
0answers
33 views

PostgreSQL 11 - Tuning of the background writer process (maxwritten_clean)

I notice that the metric maxwritten_clean in the table pg_stat_bgwriter increases (for example going from 0 to 1000 in several seconds). I guess this is understandable as it happens while there are ...
1
vote
1answer
24 views

Help understanding behavior of try_cast() with numeric strings

Erwin made a great, generic try_cast function for postgres (copied below). I'm interested in using it for an EAV schema where attributes are stored with a type field. I can use a similar function (...
2
votes
0answers
56 views

Postgresql 11: terminating walsender process due to replication timeout

I have found some questions about the same error, but didn't find any of them answering my problem. The setup is that I have two Postgres11 clusters (A and B) and they are making use of publication ...
1
vote
0answers
29 views

How to design a table schema to optimize insert and updates for a unique numeric column

Suppose there is a table with 3 columns id, name, score Name and score are both unique columns. The use case is that, The table is pre-populated with 10 rows. Scores are set from 1-9. A user can ...
1
vote
0answers
23 views

Add Unique constraint to existing table with large amount of data

I have an existing table with following schema create table event_logs ( event_id integer not null constraint event_logs_event_id_fkey references event, user_id ...
0
votes
0answers
35 views

How to Properly Configure a Time History Table?

I'm migrating a poorly planned table (in an Azure PostgreSQL db) that stores time history data, and I'm a bit overwhelmed. This history table has a composite primary key on 5 columns, 4 of which are a ...
0
votes
1answer
187 views

PostgreSQL 11: terminating walreceiver process due to administrator command

one of my PostgreSQL 11 servers was throwing a strange error and refused to correctly initiate streaming replication after a basebackup: FATAL: terminating walreceiver process due to administrator ...
1
vote
1answer
39 views

PostgreSQL 11 - Can I turn a schema into the wild west?

I have been given a task to set up a development database where all users able to access a given project schema (each project would have its own schema) would be able to do anything to any table, ...
3
votes
1answer
37 views

Why do two queries run faster than combined subquery?

I'm running postgres 11 on Azure. If I run this query: select min(pricedate) + interval '2 days' from pjm.rtprices It takes 0.153 sec and has the following explain: "Result (cost=2.19..2.20 ...
0
votes
1answer
22 views

Configure listen_addresses automatically in custom installation

I have included Postgres in a custom installer for a Windows application. I do not use the installer binary, but extract the Postgres zip archive for installation and then run initdb from a batch ...
1
vote
1answer
41 views

When changing the default port number from 5432 to 5332, why do I get a unix domain socket error?

I successfully followed the Postgres 11 installation instructions on Centos 7 found here. I am able to successfully create schemas / tables and insert data into the database over port 5432 with no ...
2
votes
2answers
916 views

How to set statement timeout per user?

I have multiple users in Postgres. I would like to set up different statement timeouts for different users. Eg: Guest 5 minutes and Admin 10 minutes. Is it possible in Postgres 11.11?
0
votes
0answers
29 views

PostgreSQL Slave unable to catch up with the Master

We have a four node Patroni cluster setup wherein one of the nodes is unable to catchup with the leader because of huge lag. I have tried the below steps but none of them are working. Restart the ...
0
votes
0answers
74 views

Postgresql, joining most recent row from one table to another based on dates

We have several tables we have to bring together to match the most recently effective price with the transaction date. The simplified query is shown below: SELECT t.transaction_id, price.* ...
0
votes
1answer
49 views

Run DELETE on each INSERT to enforce row limit

Using PostgreSQL 11. Consider a table like CREATE TABLE "logs" ( "id" INTEGER NOT NULL, "userId" INTEGER NOT NULL, "timestamp" TIMESTAMP ...
2
votes
1answer
42 views

Why does PostgreSQL accept junk when parsing an INTERVAL

psql (11.8) Type "help" for help. public=# select '!@#$%^&*()00:00:00.01<>?<>:'::interval; interval ------------- 00:00:00.01 (1 row) Seems to take just about anything......
0
votes
0answers
12 views

postgresql logical replication sync frequency / interval

I've been trying to find something in the docs about frequency / interval of sync between subscriber and publisher under the logical replication model of postgresql Can this be specified or does it ...
0
votes
1answer
12 views

Problem calling Postgres function

I wrote this function: create or replace function field_summaries(gap interval , _tbl anyelement, _col text) returns table(hour text, average numeric, minimum numeric, ...
4
votes
1answer
352 views

What is the correct way to make an exact copy of a database with pg_dump?

Basically, I'm trying to make a SQL dump that will make an exact copy of a database: user defined functions, relationships, constraints, tables, data, etc. Is this doable with pg_dump or does psql ...
0
votes
1answer
19 views

In which tables values will be inserted if I insert values into a view that its result is made out of inner join of 3 tables?

Ι have the following view: CREATE OR REPLACE VIEW public.my_view as SELECT col1, col11 from table_a JOIN table_b on table_a.id=table_b.a_id join ( select id,col56 from table_c where ...
1
vote
1answer
59 views

Same postgres query in two different instances with the same data but with different times

I have the same postgres query running in two different instances restored with the same dump file: one instance in aws rds => https://explain.depesz.com/s/USMO ('PostgreSQL 11.10 on x86_64-pc-...
0
votes
0answers
11 views

PostgreSQL: How to backup only One Schema from a database and restore it to other schema having same name of database? [duplicate]

I have a database named "A" which has three schemas "B","C" and "D". I want to take backup of schema "C" and restore the data to Schema "B"?...
0
votes
1answer
66 views

How does Postgres decide if to use additional workers?

I have the following table with an added BTREE-index on "captured_at". CREATE TABLE datagram ( id bigserial NOT NULL, src_re integer ...
1
vote
1answer
27 views

Having regex_matches exclude cases where both capturing groups match a 0-length string

I'll trying to write a regex pattern that will help me create an array of length 2 arrays such that each inner array is matched like so: I'm looking to split sequences that begin with a positive or ...
1
vote
0answers
119 views

Postgres row estimate is very low for hash join

I have a query that keeps thinking that the result of a hash join will be 1 and I don't know which knob to turn to fix it. The query takes a form field values in a revision of a document and maps them ...
0
votes
1answer
21 views

How I can check whether 2 databases despite being in different postgresql servers of versions are the same?

I copied an existing posttgresql database from one server to another. The source of my data is a postgresql 9.6 whilst the newer server is in postgresql 11. So I want to know how I can check that both ...
0
votes
1answer
37 views

Multicolumn GIN index not fully facilitated by query planner

I am experiencing unexpected behaviour with ProstgreSQL 11.10 query planner with multicolumn GIN index usage. After defining an index on two columns (a,b) of a large table and executing a query ...
1
vote
1answer
129 views

PostgreSQL undocumented timenow() function?

Looking at the documentation of PostgreSQL I couldn't find anything on timenow(). Yet if I call the function it works. So what is the difference between now() and timenow() ? I am going to guess that ...
0
votes
0answers
20 views

Full text search with mispelled greek words fails to retrieve the epxected results

I have the following table named search_index: id PK SERIAL key UNSIGNED INTEGER value TEXT And over the table I ηαωε τηε following values id | key | value --- | --- | --- 1 | 1 | 'χαλανδρι' 2 ...
0
votes
0answers
194 views

pg_basebackup: COPY stream ended before last file was finished

I am unable to add a replica member back into the cluster. Setup: Haproxy, patroni, consul, postgresql11 Cluster: Leader, standby, 3 replica(all 3 failed in adding back to cluster) I could see the ...
3
votes
2answers
423 views

Postgres 11: Query plan uses seq scan after upgrade

The Situation We have a database hosted on RDS with a few hundred tables, a few of which are quite large. We recently upgraded the database from 9.5.22 to 11.8 and performance is significantly ...
0
votes
1answer
228 views

Unable to upgrade to postgresql 13

I'm getting the following error: postgres@:~/>cat loadable_libraries.txt could not load library "$libdir/plpython2": ERROR: could not access file "$libdir/plpython2": No such ...
0
votes
1answer
51 views

How can I trace the cause of a memory spike in Postgres?

The title tells the story, but how can I trace the cause of a memory spike in Postgres 11.10? As you can see from the screen shot below there was a memory spike all the way up to 32 GB which caused ...
0
votes
0answers
30 views

Is it possible to record read access to a row?

A table has a creation timestamp column with DEFAULT and an update timestamp column with DEFAULT ... ON UPDATE .... Similar to the ON UPDATE|DELETE ... constraint, we're looking for a way to have a ...
0
votes
0answers
29 views

How do you aggregate values from jsonb_array_elements into a separate list grouping by another column?

I've got a psql table. Two of the columns are: Table "public.messages" Column | Type | Collation | Nullable | ...
0
votes
1answer
24 views

Using activity over last few days to label user as "active"

Here's an example dataset. with activity_cte (day, user_id, act1, act2) as ( values ('2020-01-01'::date, 1, 0, 1), ('2020-01-01'::date, 3, 1, 0), ('2020-01-02'::date, 1, 3, ...
1
vote
0answers
375 views

Error that role of the previous master user does not exist when restoring a database to a different server with different master username

I have to move a postgres database to another server. Both servers are Postgres 11.8 on Amazon RDS. I'm dumping the original jira database like this: pg_dump \ --dbname=postgresql://postgres:***@...
1
vote
1answer
195 views

PostgreSQL extremely slow counts

I'm experiencing extremely slow count(*) speeds, inside a table with 5845897rows, counting the number of rows takes around 2 minutes (113832.950 ms). EXPLAIN ANALYZE SELECT COUNT(*) FROM campaigns; ...
1
vote
0answers
14 views

How I can find whitch reports use views that are generated from specific tables?

I have the following table named reports: report_code PK VARCHAR 5 report_sql TEXT The report_sql stores the sql code that generates a report. The sql code is in postgresql flavor. So from that ...
0
votes
2answers
116 views

search path is getting updated automatically

In postgres 11.5 for a running session suddenly lot of errors reported in pg_logs "relation does not exist". After enabling extra logging we have found out that just before the errors the ...
0
votes
2answers
71 views

What SQL execution time should I expect when querying 4k records in a 150M records table?

We currently have performance issues with a SQL query on RDS Postgres 11.8. Here is the query: SELECT id FROM answer_submission WHERE student_id = 3983137; The table "answer_submission" has ...
1
vote
0answers
66 views

Reduce Count(*) time for many records [closed]

Query: EXPLAIN ANALYZE select count(*) from product; ROWS: 534965 EXPLANATION : Finalize Aggregate (cost=53840.85..53840.86 rows=1 width=8) (actual time=5014.774..5014.774 rows=1 loops=1) -> ...
5
votes
1answer
121 views

Determine Nodes in Network with PostgreSQL

I have a table where every entry is a node and the table contains the direct connections of each node to other nodes. I am looking to create a view with a column for each node containing all the nodes ...
0
votes
0answers
50 views

How I can find the most resource-intensive queries that has ever run in my database and use a specific table?

In my database I want to check whether my idea on an improvement upon table schema works. Therefore I want so look which are the heaviest select queries ever run into our database and use a specific ...
2
votes
0answers
40 views

Check constraint on a pair of columns

I have a table with this structure: create table licence_report ( id bigint default nextval('licence_report_id_seq'::regclass) not null, created ...

1
2 3 4 5