Re: Need to find the no. of connections for a database

2020-02-26 Thread sivapostg...@yahoo.com
Hello, Before taking a few reports, we need to ensure that only one connection is made to the database and all other computers need to close the connection to that database.   This is to prevent any additional entry(ies) that could be made during the course of the report taking.  This single-use

Re: information_schema performance in Postgres 12

2020-02-26 Thread Tom Lane
Eric Gillum writes: > Does not seem to improve if I turn off JIT. AFAICT you're just getting sideswiped by the poor quality of our estimates for messy sub-SELECTs :-(. v12 is estimating that it will get only one row out of the information_schema.table_constraints sub-select, which causes it to d

Re: information_schema performance in Postgres 12

2020-02-26 Thread Eric Gillum
Does not seem to improve if I turn off JIT. # show jit; on # explain analyze SELECT tc.table_name, ... Planning Time: 8.806 ms Execution Time: 511.249 ms # set jit=false; # show jit; off # explain analyze SELECT tc.table_name, ... Planning Time: 8.980 ms Execution Time: 506.016 ms On Wed,

Re: Error “cache lookup failed for function”

2020-02-26 Thread Albrecht Dreß
Sorry for the late reply, I've been on a short vacation… Am 21.02.20 21:44 schrieb(en) Adrian Klaver: 1) From your original post what does the below mean?: -- add several db functions One trigger function, plus two “normal” ones, all (yet) unused. -- replace a DB function: This was the -

How to know if initial sync of logical subscription is finished

2020-02-26 Thread Klaus Darilion
Hello all! When subscribing a slave I need to know when the initial sync is finished. Is there some table I can query to know if the initial sync is finished? Thanks Klaus

Re: information_schema performance in Postgres 12

2020-02-26 Thread Michael Lewis
Have you tried with JIT turned off in PG12? The long running node is ProjectSet type which is related to set returning functions. If that is getting evaluated differently in PG12, that may be issue.

Re: How to install check_postgres on CentOS 8?

2020-02-26 Thread rainer
Am 2020-02-26 17:23, schrieb Paul Förster: Hi Rainer, I'd suggest that your perl package is the most recent. Just a wild guess, though. But what I'd suggest more is that you download the source archive and compile the whole package yourself for your target platform. This is what I always do. I

Re: information_schema performance in Postgres 12

2020-02-26 Thread Eric Gillum
I had not run the script per se, I had run ANALYZE. I just re-upgraded to a separate cluster and ran the provided script. The query still takes about 500ms. On Wed, Feb 26, 2020 at 7:56 AM Adrian Klaver wrote: > On 2/25/20 8:53 PM, Eric Gillum wrote: > > Hello, > > > > I've noticed a ~50x regres

Re: Highly academic: local etcd & Patroni Cluster for testing on a single host

2020-02-26 Thread Paul Förster
Hi Ian, > On 26. Feb, 2020, at 09:27, Ian Barwick wrote: > It doesn't - it takes the tablespace location directly from the symlink in > the "pg_tblspc" > directory (since PostgreSQL 9.2), so you can manipulate those manually, > provided the server > isn't running of course. > > Not sure how th

Re: How to install check_postgres on CentOS 8?

2020-02-26 Thread Paul Förster
Hi Rainer, I'd suggest that your perl package is the most recent. Just a wild guess, though. But what I'd suggest more is that you download the source archive and compile the whole package yourself for your target platform. This is what I always do. I never install a precompiled rpm. This way,

Re: information_schema performance in Postgres 12

2020-02-26 Thread Adrian Klaver
On 2/25/20 8:53 PM, Eric Gillum wrote: Hello, I've noticed a ~50x regression in execution time for a query when moving from Postgres 11.6 to 12.1. Here's an example: SELECT tc.table_name, kcu.column_name, ccu.table_name AS foreign_table_name, ccu.column_name AS foreign_column_name FROM info

How to install check_postgres on CentOS 8?

2020-02-26 Thread rainer
Hi, I'm trying to install the check_postgres RPM from the official postgresql.org repository onto CentOS 8.1 It says: Error: Problem: cannot install the best candidate for the job - nothing provides perl-DateTime-Format-DateParse needed by check_postgres-2.25.0-1.rhel8.noarch (try to add

Re: Invoice increment

2020-02-26 Thread Vik Fearing
On 26/02/2020 10:27, Vik Fearing wrote: > WITH > u (invoice_number) AS ( > UPDATE invoice_numbers > SET invoice_number = invoice_number + 1 > WHERE country = $1 > RETURNING invoice_number > ), > i (invoice_number) AS ( > INSERT INTO invoice_numbers (country, invoice_number) >

Re: Invoice increment

2020-02-26 Thread Søren Frisk
This looks to be the way to go! Thank you very much. I'll do the function in my application code to have it in version control. But it helped me wrap my head around it. Den ons. 26. feb. 2020 kl. 10.27 skrev Vik Fearing : > On 26/02/2020 09:38, Søren Frisk wrote: > > Hi all > > > > I'm trying to

Re: Invoice increment

2020-02-26 Thread Peter J. Holzer
On 2020-02-26 09:38:57 +0100, Søren Frisk wrote: > I'm trying to find a way to increment an invoice number. And i think it would > be pretty straight forward just using a SERIAL int. Be careful: Sequences may have gaps (e.g. because of rolled back transactions, but maybe also for other reasons). I

Re: Invoice increment

2020-02-26 Thread Vik Fearing
On 26/02/2020 09:38, Søren Frisk wrote: > Hi all > > I'm trying to find a way to increment an invoice number. And i think it > would be pretty straight forward just using a SERIAL int. But as we're > selling across multiple countries, i need the invoice increment to be reset > by a country_id. any

Re: Invoice increment

2020-02-26 Thread Sándor Daku
On Wed, 26 Feb 2020 at 09:54, Søren Frisk wrote: > Hi all > > I'm trying to find a way to increment an invoice number. And i think it > would be pretty straight forward just using a SERIAL int. But as we're > selling across multiple countries, i need the invoice increment to be reset > by a count

Invoice increment

2020-02-26 Thread Søren Frisk
Hi all I'm trying to find a way to increment an invoice number. And i think it would be pretty straight forward just using a SERIAL int. But as we're selling across multiple countries, i need the invoice increment to be reset by a country_id. any good way to achieve this in a dynamic way? Hope thi

information_schema performance in Postgres 12

2020-02-26 Thread Eric Gillum
Hello, I've noticed a ~50x regression in execution time for a query when moving from Postgres 11.6 to 12.1. Here's an example: SELECT tc.table_name, kcu.column_name, ccu.table_name AS foreign_table_name, ccu.column_name AS foreign_column_name FROM information_schema.table_constraints tc JOIN info

Re: Highly academic: local etcd & Patroni Cluster for testing on a single host

2020-02-26 Thread Paul Förster
Hi Alexander, > On 26. Feb, 2020, at 09:19, Alexander Kukushkin wrote: > That's not correct, Patroni will happily pick up the existing data directory. maybe I didn't express myself correctly. Of course it does. Otherwise replication wouldn't make sense. I meant, starting a Patroni replica for t

Re: Highly academic: local etcd & Patroni Cluster for testing on a single host

2020-02-26 Thread Ian Barwick
On 2020/02/26 16:55, Paul Förster wrote: Hi Ian, On 26. Feb, 2020, at 01:38, Ian Barwick wrote: Assuming the standby/replica is created using pg_basebackup, you can use the -T/--tablespace-mapping option to remap the tablespace directories. no, with Patroni, replicas are always initiated by

Re: Highly academic: local etcd & Patroni Cluster for testing on a single host

2020-02-26 Thread Alexander Kukushkin
Hi, On Wed, 26 Feb 2020 at 08:55, Paul Förster wrote: > no, with Patroni, replicas are always initiated by Patroni. Patroni copies > the whole PGDATA including everything (postgresql.conf, etc.) in it to the > replica site. When launching Patroni for the first time, all you need is its > yaml