Re: survey: psql syntax errors abort my transactions

2020-07-06 Thread Laurenz Albe
On Fri, 2020-07-03 at 12:46 -0500, Ron wrote: > > This is my favorite example why I like the way PostgreSQL does things: > > > > /* poor man's VACUUM (FULL) */ > > BEGIN; > > CREATTE TABLE t2 AS SELECT * FROM t1; > > DROP TABLE t1; > > ALTER TABLE t2 RENAME TO t1; > > COMMIT; > > How so, since it

PostgreSQL server does not increment a SERIAL internally

2020-07-06 Thread Matthias Apitz
Hello, Me and my team passed a full weekend hunting a bug in our Perl written software were rows have been inserted with the same id 'acq_haushalt.hnr' which should not have been the case because any budget year in that table has a single internal number 'hnr' The table in the 11.4 server is cr

Using Postgres jdbc driver with Oracle SQL Developer

2020-07-06 Thread Niels Jespersen
Hello all Oracle SQL Developer allows you to add what they call a Third Party JDBC Driver. With that you can connect and use SQL Developer against Postgres. So far, so good. But when you connect, there is a button "Choose database" that fills a dropdown box with databasenames available on the c

SV: Using Postgres jdbc driver with Oracle SQL Developer

2020-07-06 Thread Niels Jespersen
Sorry, "way to provide a default username" should have been "way to provide a default databasename" Fra: Niels Jespersen Sendt: 6. juli 2020 13:20 Til: pgsql-general@lists.postgresql.org Emne: Using Postgres jdbc driver with Oracle SQL Developer Hello all Oracle SQL Developer allows you to add

Apply LIMIT when computation is logically irrelevant

2020-07-06 Thread Robins Tharakan
Hi, When an SQL needs to UNION constants on either side, it should be possible to implicitly apply a LIMIT 1 and get good speed up. Is this an incorrect understanding, or something already discussed but rejected for some reason? This need came up while reviewing generated SQL, where the need was

Re: PostgreSQL server does not increment a SERIAL internally

2020-07-06 Thread Sándor Daku
Hi Matthias, On Mon, 6 Jul 2020 at 11:43, Matthias Apitz wrote: > > Hello, > > Me and my team passed a full weekend hunting a bug in our Perl written > software were rows have been inserted with the same id 'acq_haushalt.hnr' > which should not have been the case because any budget year in that

Re: Apply LIMIT when computation is logically irrelevant

2020-07-06 Thread Francisco Olarte
Robins: On Mon, Jul 6, 2020 at 1:37 PM Robins Tharakan wrote: > When an SQL needs to UNION constants on either side, it should be possible to > implicitly apply a LIMIT 1 and get good speed up. Is this an incorrect > understanding, > or something already discussed but rejected for some reason?

Re: PostgreSQL server does not increment a SERIAL internally

2020-07-06 Thread Matthias Apitz
El día Montag, Juli 06, 2020 a las 01:58:04 +0200, Sándor Daku escribió: > > We update the serial 'acq_haushalt_hnr_seq' with this statement after > > loading: > > > > What does "loading" mean, and why do you reset the sequence after loading? > (And as I can see you setting it to the value it mos

Re: Apply LIMIT when computation is logically irrelevant

2020-07-06 Thread Simon Riggs
On Mon, 6 Jul 2020 at 12:37, Robins Tharakan wrote: > When an SQL needs to UNION constants on either side, it should be possible > to > implicitly apply a LIMIT 1 and get good speed up. Is this an incorrect > understanding, > or something already discussed but rejected for some reason? > > This

Re: SV: Using Postgres jdbc driver with Oracle SQL Developer

2020-07-06 Thread Tom Lane
Niels Jespersen writes: > Sorry, "way to provide a default username" should have been "way to provide a > default databasename" Not sure, but you'd be more likely to find a knowledgeable answer on the pgsql-jdbc list. regards, tom lane

Re: SV: Using Postgres jdbc driver with Oracle SQL Developer

2020-07-06 Thread Dave Cramer
On Mon, 6 Jul 2020 at 09:33, Tom Lane wrote: > Niels Jespersen writes: > > Sorry, "way to provide a default username" should have been "way to > provide a default databasename" > > Not sure, but you'd be more likely to find a knowledgeable answer > on the pgsql-jdbc list. > > Same way, in the pr

Re: PostgreSQL server does not increment a SERIAL internally

2020-07-06 Thread Adrian Klaver
On 7/6/20 2:43 AM, Matthias Apitz wrote: Hello, Me and my team passed a full weekend hunting a bug in our Perl written software were rows have been inserted with the same id 'acq_haushalt.hnr' which should not have been the case because any budget year in that table has a single internal number

Re: SV: Using Postgres jdbc driver with Oracle SQL Developer

2020-07-06 Thread legrand legrand
Try Replacing hostname by hostname/Database? Don’t Forget ? Regards PAscal -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

Pgbench : vacuum default behaviour history

2020-07-06 Thread Christophe Courtois
Hi, We're wondering why pgbench behaves this way by default: "With neither -n nor -v, pgbench will vacuum the pgbench_tellers and pgbench_branches tables, and will truncate pgbench_history." Why pgbench_accounts not vacuumed by default? I've dug the history of pgbench until 1999. The vaccum of t

Is postgres able to share sorts required by common partition window functions?

2020-07-06 Thread Sebastien Arod
Hi all, I'm trying to optimize the following query on postgres 11.6 (running on Aurora) select distinct c1, first_value(c2) OVER (PARTITION BY c1 order by c2) AS c2, first_value(c3) OVER (PARTITION BY c1 order by c3) AS c3, first_value(c4) OVER (PARTITION BY c1 order by c4) AS c4 from t;

Re: Apply LIMIT when computation is logically irrelevant

2020-07-06 Thread Michael Lewis
On Mon, Jul 6, 2020 at 5:37 AM Robins Tharakan wrote: > This need came up while reviewing generated SQL, where the need was to > return true when > at least one of two lists had a row. > Generated SQL... yep. That will happen. Manual SQL may be more work, but often has significant reward. If yo

Re: Is postgres able to share sorts required by common partition window functions?

2020-07-06 Thread Michael Lewis
Does this give the same result and do the optimization you want? select c1, min(c2) AS c2, min(c3) AS c3, min(c4) AS c4 from t group by c1; >

Re: Apply LIMIT when computation is logically irrelevant

2020-07-06 Thread David Rowley
On Tue, 7 Jul 2020 at 00:43, Simon Riggs wrote: > > On Mon, 6 Jul 2020 at 12:37, Robins Tharakan wrote: > >> >> When an SQL needs to UNION constants on either side, it should be possible to >> implicitly apply a LIMIT 1 and get good speed up. Is this an incorrect >> understanding, >> or somethin

Re: Apply LIMIT when computation is logically irrelevant

2020-07-06 Thread Simon Riggs
On Mon, 6 Jul 2020 at 21:49, David Rowley wrote: > On Tue, 7 Jul 2020 at 00:43, Simon Riggs wrote: > > > > On Mon, 6 Jul 2020 at 12:37, Robins Tharakan wrote: > > > >> > >> When an SQL needs to UNION constants on either side, it should be > possible to > >> implicitly apply a LIMIT 1 and get go

Re: Apply LIMIT when computation is logically irrelevant

2020-07-06 Thread David Rowley
On Tue, 7 Jul 2020 at 09:03, Simon Riggs wrote: > > On Mon, 6 Jul 2020 at 21:49, David Rowley wrote: >> >> On Tue, 7 Jul 2020 at 00:43, Simon Riggs wrote: >> > >> > On Mon, 6 Jul 2020 at 12:37, Robins Tharakan wrote: >> >> (SELECT 1 FROM pg_class) UNION (SELECT 1 FROM pg_class); >> >> vs. >> >>

Re: Is postgres able to share sorts required by common partition window functions?

2020-07-06 Thread Michael Lewis
Distinct is a great way to get quick results when writing quick & dirty queries, but I rarely have them perform better than a re-write that avoids the need. It collects a ton of results, orders them, and throws away duplicates in the process. I don't love the idea of that extra work. Did you say yo

Re: Is postgres able to share sorts required by common partition window functions?

2020-07-06 Thread David G. Johnston
On Monday, July 6, 2020, Michael Lewis wrote: > Did you say you have an index on c1? > [...] > I don't know the data, but I assume there may be many rows with the same > c1 value, so then you would likely benefit from getting that distinct set > first like below as your FROM table. > Re-reading

Re: Is postgres able to share sorts required by common partition window functions?

2020-07-06 Thread David G. Johnston
On Monday, July 6, 2020, Sebastien Arod wrote: > I would have expected postgresql to "share" a preliminary sort on c1 that > would then be useful to reduce the work on all window functions but it > doesn't. > The plan shown does share - the output of one sort goes into another. Subsequent sorts

Re: Is postgres able to share sorts required by common partition window functions?

2020-07-06 Thread Sebastien Arod
Hi Michael, I simplified the real query before posting it here and I now realize that I oversimplified things. Unfortunately the real query cannot be re-written with a group by. Some of the window functions are more complex with order by clause using complex expressions involving multiple column

Efficiently advancing a sequence without risking it going backwards.

2020-07-06 Thread Paul McGarry
I have two sequences in different dbs which I want to keep roughly in sync (they don't have to be exactly in sync, I am just keeping them in the same ballpark). Currently I have a process which periodically checks the sequences and does: 1) Check values DB1sequence: 1234 DB2sequence: 1233 (1 behi

Re: Efficiently advancing a sequence without risking it going backwards.

2020-07-06 Thread Adrian Klaver
On 7/6/20 7:06 PM, Paul McGarry wrote: I have two sequences in different dbs which I want to keep roughly in sync (they don't have to be exactly in sync, I am just keeping them in the same ballpark). Currently I have a process which periodically checks the sequences and does: 1) Check values

Re: [HELP] Regarding how to install libraries

2020-07-06 Thread Praveen Kumar K S
Thank you. That solved the problem. On Fri, Jul 3, 2020 at 8:24 PM Adrian Klaver wrote: > On 7/3/20 7:21 AM, Adrian Klaver wrote: > > On 7/3/20 4:37 AM, Praveen Kumar K S wrote: > >> Hello, > >> > >> PostgreSQL libraries are required while compiling pgpool. I need to > >> install postgresql-libs

Re: libpq pipelineing

2020-07-06 Thread Samuel Williams
Hi, Here are some initial numbers. DB::Client Warming up -- db-postgres 281.000 i/100ms db-mariadb 399.000 i/100ms mysql2 533.000 i/100ms pg 591.000 i/100ms Calculating -