Re: Rules versus triggers

2020-03-09 Thread Achilleas Mantzios
On 7/3/20 5:01 μ.μ., Justin wrote: Yes a rule can rewrite query or replace the query Read through Depesz  post about rules and the weird side affects that can occurr https://www.depesz.com/2010/06/15/to-rule-or-not-to-rule-that-is-the-question/ IMHO Rules are cool. It allows for more elegant d

strange locks on PG 11 with Golang programs

2020-03-09 Thread Josef Machytka
We are lately experiencing very strange locks on PostgreSQL 11.7 when we process ETL tasks using our programs in Go 1.13.8 using standard libraries sql and pq. ETL task has to rename tables but PostgreSQL shows that this simple operation waits for Lock on relation and select from PG wiki ( https:/

Re: Real application clustering in postgres.

2020-03-09 Thread Laurenz Albe
On Fri, 2020-03-06 at 10:56 -0600, Ron wrote: > > > > RAC is not really a high availability solution: because of the shared > > > > storage, it has a sibgle point of failure. > > > This is utter nonsense. Dual redundant storage controllers > > > connected to disks in RAID-10 configurations have be

Re: Real application clustering in postgres.

2020-03-09 Thread Laurenz Albe
On Sun, 2020-03-08 at 21:13 +0100, Peter J. Holzer wrote: > But to be fair, a master/slave setup a la patroni isn't immune against > "writing junk" either: Not on the hardware level (either of the nodes > may have faulty hardware, and you may not notice it until too late), and > more importantly, n

Re: strange locks on PG 11 with Golang programs

2020-03-09 Thread Julien Rouhaud
On Mon, Mar 09, 2020 at 09:51:21AM +0100, Josef Machytka wrote: > We are lately experiencing very strange locks on PostgreSQL 11.7 when we > process ETL tasks using our programs in Go 1.13.8 using standard libraries > sql and pq. > > ETL task has to rename tables but PostgreSQL shows that this simp

Re: strange locks on PG 11 with Golang programs

2020-03-09 Thread Achilleas Mantzios
On 9/3/20 10:51 π.μ., Josef Machytka wrote: We are lately experiencing very strange locks on PostgreSQL 11.7 when we process ETL tasks using our programs in Go 1.13.8 using standard libraries sql and pq. ETL task has to rename tables but PostgreSQL shows that this simple operation waits for L

Re: strange locks on PG 11 with Golang programs

2020-03-09 Thread Josef Machytka
On Mon, 9 Mar 2020 at 09:58, Julien Rouhaud wrote: > The query displayed is just the query currently executing, but if the > connection is in a transaction the problematic lock could have been > acquired by > any previously executed query. Did you check in pg_stat_activity if the > connection i

Re: strange locks on PG 11 with Golang programs

2020-03-09 Thread Julien Rouhaud
On Mon, Mar 09, 2020 at 10:21:23AM +0100, Josef Machytka wrote: > On Mon, 9 Mar 2020 at 09:58, Julien Rouhaud wrote: > > > The query displayed is just the query currently executing, but if the > > connection is in a transaction the problematic lock could have been > > acquired by > > any previousl

Who mades the inserts?

2020-03-09 Thread Durumdara
Dear Members! We have more than 200 databases in a server. The PGAdmin's dashboard shows me 4500 inserts periodically. I want to know which database(s) causes this. Do you know any query which can show me the inserts per databases? And I don't know it works as TPS query? So I need to make diffe

Query to retrieve the index columns when a function is used.

2020-03-09 Thread Sterpu Victor
Hello I'm testing on Postgresql 12.1 and I have a index like this: "check_dates_gist" EXCLUDE USING gist (id_test1 WITH =, id_test2 WITH =, tsrange(valid_from::timestamp without time zone, valid_to::timestamp without time zone) WITH &&) When I run this query: "select pc.relname, pi.indisuni

Re: Who mades the inserts?

2020-03-09 Thread Andreas Kretschmer
Am 09.03.20 um 13:52 schrieb Durumdara: Do you know any query which can show me the inserts per databases? And I don't know it works as TPS query? So I need to make differents between measured values in two time point? yes, you can use tup_inserted from pg_stat_database. Regards, Andreas

Re: Who mades the inserts?

2020-03-09 Thread Justin
Hi DD By default Postgresql does not collect this level of detail information to tell you which database has a high load at X point in time. You can infer which database has this high load without increasing logging Select * from pg_stat_database this dumps total inserts, update, scans etc..

Re: Table with many NULLS for indexed column yields strange query plan

2020-03-09 Thread greigwise
Seqscans are not disabled. Also, this is PostgreSQL 10.11 if that helps. Costs are as follows: seq_page_cost --- 1 random_page_cost -- 1.5 It is odd that it does not just do a seqscan on table3. It's a very small table... only like 36 rows. I'd think the pla

Re: Real application clustering in postgres.

2020-03-09 Thread Andreas Kretschmer
Am 05.03.20 um 13:07 schrieb Laurenz Albe: There is a closed-source implementation that you can buy: https://www.2ndquadrant.com/en/resources/postgres-bdr-2ndquadrant/ But multi-master replication is complicated to get right, and an applicatoin that uses it has to be specifically designed for

Re: Is it safe to rename an index through pg_class update?

2020-03-09 Thread Kouber Saparev
На пт, 6.03.2020 г. в 21:00 Andres Freund написа: > Hi, > > On 2020-02-27 10:52:36 -0500, Tom Lane wrote: > > FWIW, I can't immediately think of a reason this would cause a problem, > > at least not on 9.4 and up which use MVCC catalog scans. If you're > > really still on 9.3 then it's notably m

gdal version for Postgis 2.4?

2020-03-09 Thread Zwettler Markus (OIZ)
I am in the same situation: I found that Postgis 24 depends on gdal30-libs.x86_64 0:3.0.4-2. But this installation creates an error : dbname=# create extension postgis; ERROR: could not load library "/usr/pgsql-11/lib/rtpostgis-2.4.so": /usr/gdal30/lib/libgdal.so.26: undefined symbol: GEOSMakeVal

Re: Is it safe to rename an index through pg_class update?

2020-03-09 Thread Andres Freund
Hi, On 2020-03-09 17:47:23 +0200, Kouber Saparev wrote: > На пт, 6.03.2020 г. в 21:00 Andres Freund написа: > > On 2020-02-27 10:52:36 -0500, Tom Lane wrote: > > > FWIW, I can't immediately think of a reason this would cause a problem, > > > at least not on 9.4 and up which use MVCC catalog scans

Re: gdal version for Postgis 2.4?

2020-03-09 Thread Adrian Klaver
On 3/9/20 8:50 AM, Zwettler Markus (OIZ) wrote: I am in the same situation: I found that Postgis 24 depends on gdal30-libs.x86_64 0:3.0.4-2. But this installation creates an error : dbname=# create extension postgis; ERROR: could not load library "/usr/pgsql-11/lib/rtpostgis-2.4.so": /usr/gdal3

libpq prepared statement insert null for foreign key

2020-03-09 Thread Ted Toth
I tries setting the parameter for the foreign NULL: params[i] = NULL; and I get a 'Key not present in table ...' error. How do I insert a record where I don't have a foreign key yet? Ted

Re: libpq prepared statement insert null for foreign key

2020-03-09 Thread Adrian Klaver
On 3/9/20 5:00 PM, Ted Toth wrote: I tries setting the parameter for the foreign NULL: params[i] = NULL; I think you will need to show the code previous to the above. and I get a 'Key not present in table ...' error. How do I insert a record where I don't have a foreign key yet? Ted --

V9.5

2020-03-09 Thread Sonam Sharma
We have pg_read_all_stats role from v9.6. do we have a similar role for v9.5 and lower versions ?