Questions tagged [postgresql-10]
for PostgreSQL questions specific to version 10
608
questions
1
vote
0
answers
40
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
23
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;
...
-1
votes
0
answers
18
views
Vacuum full Task is taking more than two hours in PostgreSQL
I have a database with size 1062 MB only. It takes more than two hours to complete the vacuum full task. It has 6 GB RAM and number of cores is 6. Someone suggest me how to troubleshoot this issue.
0
votes
0
answers
10
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
45
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 ...
0
votes
0
answers
17
views
POstgresql@10-min is not active ubuntu odoo
================
Configuration VM :
Cpu : 4
Ram : 8gb
Os : Ubuntu
Software : Odoo
Hello ,
i have an issue yesterday in odoo i had error said bad 500 gateway
i checked Ngnix status looks Working all is ...
0
votes
0
answers
60
views
ERROR: could not access file "$libdir/postgis-3": No such file or directory With postgres 10 in ubuntu
I'm trying to open spatial data table and it is showing error:could not access file "$libdir/postgis-3": No such file or directory.
It is showing the same error while I'm taking backup of ...
0
votes
1
answer
223
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
48
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 ...
0
votes
0
answers
56
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
56
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
51
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
45
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
118
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
0
answers
53
views
Incrementing value concurrently depending on other columns avoiding deadlocks in Postgresql
I created a table like this one:
CREATE TABLE temporal.mytable (
id serial NOT NULL,
a varchar NOT NULL,
b varchar NOT NULL,
myseq int NULL,
CONSTRAINT mytable_pk PRIMARY KEY (id),
...
0
votes
2
answers
134
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&...
2
votes
1
answer
290
views
Remove "identity flag" from a column in PostgreSQL
I have some tables in PostgreSQL 12.9 that were declared as something like
-- This table is written in old style
create table old_style_table_1 (
id bigserial not null primary key,
...
);
-- ...
1
vote
1
answer
287
views
Optimize PostgreSQL query with levenshtein() function
I have a table with approximately 7 million records. The table has a first_name and last_name column which I want to search on using the levenshtein() distance function.
select levenshtein('JOHN', ...
1
vote
1
answer
466
views
Postgres "invalid input syntax for type oid:"
I am using Postgres 10 on Centos (PostgreSQL 10.17 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit)
When I execute the SQL statement below I receive the error &...
0
votes
2
answers
298
views
AWS RDS PostgreSQL Upgrade from 9.6.22 to 10.17
Good day. I just finished upgrading my AWS RDS database engine from 9.6.22 to 10.17. I used these steps to make the upgrade using the AWS Console:
Create snapshot of target database to upgrade
...
1
vote
1
answer
855
views
Postgres upgrade from 10 to 12: pg_upgrade fail for presence of required library
$ /usr/pgsql-12/bin/pg_upgrade \
> -b /usr/pgsql-1
pgsql-10/ pgsql-12/
> -b /usr/pgsql-10/bin/ \
> -B /usr/pgsql-12/bin/ \
> -d /var/lib/pgsql/1
10/ 12/
> -d /var/lib/pgsql/10/data/ \
&...
0
votes
0
answers
12
views
how to temporarily disable all the indexes of a PARTICULAR SCHEMA in postgresql
Looking forward for a script to disable all the indexes in a particular schema only .
there are many schemas, only for one schema want to disable the indexes.
Thanks
0
votes
1
answer
110
views
Postgres DB performance issue
I'm suspecting our Postgres DB has performance issue so I'm troubleshooting.
First I'm running a query below from my local laptop like below;
"select * from table1"
And this table has 7 ...
0
votes
1
answer
89
views
Need help in using the 'analyze-in-stages' option of the vacuumdb command
I have a PostgreSQL 10 cluster containing many databases, the total size is 500 Gb. I have launched the vacuumdb command using the analyze-in-stages option :
vacuumdb --all --verbose --analyze-in-...
-1
votes
1
answer
19
views
JSON values from objects inside an Array
So i have this json column in my postgres (v.10) database.
It can look like this:
[{"_destroy": false, "gruppe_id": "verwalter"}, {"_destroy": "", &...
2
votes
0
answers
972
views
Postgres sqlx upsert causing pq: duplicate key value violates unique constraint
I have a table with a unique index called user_conn_unique and I perform an 'upsert' on that table however intermittently I am getting an error pq: duplicate key value violates unique constraint "...
0
votes
0
answers
41
views
PostgreSQL Database startup failure while starting the DB with gMSA (group Managed Service Account). How to troubleshoot it?
I'm facing PostgreSQL Database startup failure while starting with group Managed service Account. There is no error in PostgreSQL logs. PostgreSQL folder has the full control permission for the gMSA. ...
1
vote
0
answers
172
views
Azure Postgres AUTOVACUM AND ANALYZE THRESHOLD - How to change it?
I am coming again with another Postgres question. We are using the Managed Service from Azure that uses autovacuum. Both vacuum and statistics are automatic.
The problem I am getting is that for a ...
1
vote
1
answer
226
views
Postgres performance issue with query based on filter values
I am not an expert in Postgres, but I am trying to understand this strange behaviour and perhaps some of you might give me some insight.
Those are the tables and indexes involved
Tables
CREATE ...
0
votes
0
answers
47
views
filtering jsonb columns in loopback
I am trying to filter jsonb columns in my loopback application but unable to.
Here is my model :
import {Entity, model, property} from '@loopback/repository';
@model({
settings: {idInjection: false,...
0
votes
1
answer
57
views
Merging two databases into one postgresql instance - Error user does not exist
PostgreSQL 10.7 question.
I have three PGSERVERs: LIVE1, LIVE2, and TRAIN
The LIVE1 and LIVE2 contain databases for my production data. The TRAIN area is for training and testing and contains a copy ...
0
votes
0
answers
51
views
There's an error while typing the password on pgAdmin 4 PostgreSQL 10 Server
This is the result that I get any time I enter the password that I created to enter the PostgreSQL 10 Server. I'm 100% sure that the password that I add is correct, but for some reason, this error ...
1
vote
1
answer
2k
views
Another postgres not starting: "could not map anonymous shared memory"
I noticed there are several questions about Postgres (10) not able to boot because of the shared memory; despite that I couldn't really make it run. Now everytime I try to start the cluster I keep ...
0
votes
1
answer
453
views
Optimal Postgres partitioning based on date
I am looking at ways to improve deletion of data in my Postgres (partitioned) tables, not worsening the access performance.
Using: Postgres 10.2
Ignoring some unrelated columns, I have the table ...
3
votes
2
answers
518
views
How to do `UPDATE...SET...FROM` using knex?
What's the most terse way I can express an UPDATE...SET...FROM SQL statement using knex? This is what I've got currently:
const query =
knex('user_subscriptions').update(subscription).toQuery() +...
1
vote
1
answer
48
views
Invalid input syntax for type interval Error
When i add a day to a date in postgres as below
SELECT '2018-08-20 00:00:00.0' + INTERVAL '1 DAY';
Getting below exception in pgAdmin4. Can any one help me here.
ERROR: invalid input syntax for type ...
0
votes
2
answers
818
views
Get value from JSON array in postgres
I have a strange JSON array in my Postgres Database without curly brackets. It has the datatype Text so i need to cast it in a JSON i guess.
It looks like this and can change from row to row.
[
[...
0
votes
1
answer
25
views
Query for array elements inside Jsonb type postgreSQL
I have a psql table where one of the jsonb data is extracted over it.
{
"SrcRcs": [4, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 158],
"reason": "",
"...
0
votes
0
answers
148
views
Odoo 10 migration on Docker container, Connection to the database failed
Hi Everyone,
I am performing an Odoo Migration using OpenUpgrade with dockers containers.
-> A container for my Odoo 10 Server;
-> A container for my PostgreSQL Database Server;
When I run ...
0
votes
1
answer
39
views
Resequence (reorder) in column return false
Based on mysql:
SET @ordering_inc = 1;
SET @new_ordering = 0;
UPDATE tasks
SET order = CONCAT("p/", @new_ordering := @new_ordering + @ordering_inc));
Result:
id | order
21 | p/1
32 | p/2
53 ...
0
votes
0
answers
260
views
Unable to update row of table with Row Level Security
I'm trying to update a row in a table with row level security policies, but keep getting the error new row violates row-level security policy for table "my_table".
Here's how I set up RLS ...
0
votes
1
answer
66
views
Set rows visibility using Policy and RLS
I need to hide the rows with deleted = true values for all select statements to the table.
I thought of using row level security with a select policy, but it does not seem to work.
Here's what I tried:...
0
votes
0
answers
411
views
How to backup/recover database after a "missing chunk number 0" message?
PostgreSQL. When I try to backup the database via pgAdmin, I get error
pg_dump: error: Dumping the contents of table "filearchives" failed: PQgetResult() failed.
pg_dump: error: Error ...
1
vote
1
answer
64
views
Drop temporary table when exiting function that return a JSON in PostgreSQL
I'm new on PostgreSQL and I want to know why my temporary table is not dropped after a return different to return query.
I can execute this function many times without a "table already exists&...
0
votes
1
answer
1k
views
How to convert postgres "double precision" to "numeric" without data loss/truncation
We have an existing column(type- double precision) in our postgres table and we want to convert the data type of that column to numeric, we've tried the below approaches but all of them had truncation/...
0
votes
1
answer
87
views
Setting NEW.column in "before update" trigger sets values from previous trigger call
I'm trying to create a before update trigger for a table. Basically, on each row update I need to set additional column on the same row on the same table.
However, for some reason, each trigger call ...
1
vote
0
answers
358
views
Pgbouncer super slow
We've been using pgbouncer for couple days now and found out that the bouncer is super slow.
I'd like to have your feedback on what is wrong with my bouncer configuration:
Pressures table is 600k rows
...
2
votes
0
answers
166
views
postgreSQL slow query with high shared read
i have a problem with my postgreSQL database, actually i'm developer not DBA so i don't have enough experience to deal with problems like this.
I ran this query at my psql:
explain (analyze true, ...
0
votes
3
answers
120
views
Unable to get all the values from JSON_ARRAY_ELEMENTS()
Table with sample data:
create table tbl_jsdata
(
id int,
p_id int,
field_name text,
field_value text
);
insert into tbl_jsdata values
(1,101,'Name','Sam'),
(2,101,'City','Dubai'),
(3,101,'...
0
votes
1
answer
94
views
Format JSON array data
Table with sample data:
create table tbl_jsdata
(
id int,
p_id int,
field_name text,
field_value text
);
insert into tbl_jsdata values
(1,101,'Name','Sam'),
(2,101,'City','Dubai'),
(3,101,'Pin','...