Re: Undetected Deadlock

2022-02-09 Thread Simon Riggs
On Wed, 9 Feb 2022 at 23:50, Michael Harris wrote: > > On Mon, 7 Feb 2022 at 09:57, Tom Lane wrote: > > Do you want to try this and see if it actually adds any robustness with > > your buggy code? > > Sorry for the delayed response, & thanks for the patch. > > I wasn't able to test with our actu

Re: Can we go beyond the standard to make Postgres radically better?

2022-02-09 Thread David G. Johnston
On Wed, Feb 9, 2022 at 10:15 PM Guyren Howe wrote: > There are huge developer benefits available to focusing more on making a > great relational programming environment, well outside the SQL standard. > Sure > > Examples of small things Postgres could have: > >- *SELECT * - b.a_id from a na

Can we go beyond the standard to make Postgres radically better?

2022-02-09 Thread Guyren Howe
Postgres has since the outset gone beyond the SQL standard in many ways : types, inheritance, programmability, generality are all well beyond what SQL used to mandate and still well beyond the current standard. There are huge developer benefits available to focusing more on making a great relat

Re: Compile 14.1 in EL5.8

2022-02-09 Thread Thomas Munro
On Thu, Feb 10, 2022 at 2:23 PM Tom Lane wrote: > Thomas Munro writes: > > ... I wondered about also removing the leftover comment > > "We assume that any system that has Linux epoll() also has Linux > > signalfd()" which was my attempt to explain that there wasn't a > > separate configure check

Re: Compile 14.1 in EL5.8

2022-02-09 Thread Tom Lane
Thomas Munro writes: > ... I wondered about also removing the leftover comment > "We assume that any system that has Linux epoll() also has Linux > signalfd()" which was my attempt to explain that there wasn't a > separate configure check for signalfd.h, but I guess the sentence is > still true in

Re: Compile 14.1 in EL5.8

2022-02-09 Thread Thomas Munro
On Thu, Feb 10, 2022 at 3:38 AM Tom Lane wrote: > Gabriela Serventi writes: > > Hi! I'm trying to compile release 14.1 in a very old Linux Server (Red Hat > > Enterprise Linux Server release 5.8). I can run configure successfully, but > > when I try to run make, I get the following error: > > lat

Re: Performance issue questions

2022-02-09 Thread Bruce Momjian
On Thu, Feb 10, 2022 at 05:11:07AM +0530, Rama Krishnan wrote: > Hi all,  > > It was a famous interview question > > If the table contains multiple indexes what kind of performance issue or > impact > will be there. Sure: https://momjian.us/main/blogs/pgblog/2012.html#July_9_2012

Re: Undetected Deadlock

2022-02-09 Thread Tom Lane
Michael Harris writes: > On Mon, 7 Feb 2022 at 09:57, Tom Lane wrote: >> Do you want to try this and see if it actually adds any robustness with your >> buggy code? > Sorry for the delayed response, & thanks for the patch. > I wasn't able to test with our actual application because it could >

Re: Undetected Deadlock

2022-02-09 Thread Michael Harris
On Mon, 7 Feb 2022 at 09:57, Tom Lane wrote: > Do you want to try this and see if it actually adds any robustness with your > buggy code? Sorry for the delayed response, & thanks for the patch. I wasn't able to test with our actual application because it could take days for it to actually trigg

Performance issue questions

2022-02-09 Thread Rama Krishnan
Hi all, It was a famous interview question If the table contains multiple indexes what kind of performance issue or impact will be there.

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread David G. Johnston
On Wed, Feb 9, 2022 at 2:24 PM Thomas Kellerer wrote: > David G. Johnston schrieb am 09.02.2022 um 21:47: > > You cannot defer uniqueness checks to transaction commit so either it > > is going to fail on the insert or it will not fail at all. > > You can defer unique constraints, but not primary

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Thomas Kellerer
David G. Johnston schrieb am 09.02.2022 um 21:47: You cannot defer uniqueness checks to transaction commit so either it is going to fail on the insert or it will not fail at all. You can defer unique constraints, but not primary key constraints. create table t ( id integer ); alter table t

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Bryn Llewellyn
> david.g.johns...@gmail.com wrote: > > The convention on these lists is to inline or bottom post (and to trim the > reply to just the pertinent parts). Just for completeness, I expected this test to run without error. (I tried it in PG Version 14.1). create table t(k int primary key, v text n

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread David G. Johnston
The convention on these lists is to inline or bottom post (and to trim the reply to just the pertinent parts). On Wed, Feb 9, 2022 at 12:33 PM Brent Wood wrote: > Because both statements are in the transaction, the delete is not fully > actioned until the commit. So it still exists in the table

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Adrian Klaver
On 2/9/22 10:34, Brent Wood wrote: My take on this... Because both statements are in the transaction, the delete is not fully actioned until the commit. So it still exists in the table when you try to insert the record with the duplicate key. No: \d animals Table "publ

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Andrew Hardy
Really appreciate the input thank you. I shall try to provide a full script, I guess if the cascades are relevant in going to have to also provide all of the indirect table creations and all of the earlier inserts to those various tables. At the very least I'll try to provide a fuller error messa

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Brent Wood
My take on this... Because both statements are in the transaction, the delete is not fully actioned until the commit. So it still exists in the table when you try to insert the record with the duplicate key. Check if the error is generated during the transaction or at the commit stage, run it

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread David G. Johnston
On Wed, Feb 9, 2022 at 11:12 AM Andrew Hardy wrote: > Do I need some particular kind of settings on my transaction to be able to > delete and insert afresh in the same transaction? > No. I cannot reproduce your claim with a trivial example on stock 13.5. You will need to be less vague and at l

Re: DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Adrian Klaver
On 2/9/22 10:11 AM, Andrew Hardy wrote: Hi, When I: Begin a transaction DELETE from where id (PK) = INSERT INTO VALUES () ... ... ... COMMIT I get insert into "itinerary" ("dk", "locator") values ($1, $2) - duplicate key value violates unique constraint "itinerary_pkey" = itinerary? W

DELETING then INSERTING record with same PK in the same TRANSACTION

2022-02-09 Thread Andrew Hardy
Hi, When I: Begin a transaction DELETE from where id (PK) = INSERT INTO VALUES () ... ... ... COMMIT I get insert into "itinerary" ("dk", "locator") values ($1, $2) - duplicate key value violates unique constraint "itinerary_pkey" Do I need some particular kind of settings on my transaction

Re: Network Card Not Listening at Startup

2022-02-09 Thread Tom Lane
Ludwig Isaac Lim writes: > How do make sure that NIC will be listening every time I started/restarted > the server? You need to tell systemd not to start the postgresql service until the network is up. In basic cases, you can edit the postgresql.service file, or maybe better create an add-on co

Network Card Not Listening at Startup

2022-02-09 Thread Ludwig Isaac Lim
Hello: I'm running postgresql 12.9 on Amazon Linux in AWS.  My listen_addresses in postgresql.conf is configured like below: listen_addresses = '172.17.1.57,localhost'  However, postgresql does not listen on 172..17.1.57. I can reproduce the phenomenon by simply rebooting the server and then r

Re: Why are data files getting modified?

2022-02-09 Thread Laurenz Albe
On Thu, 2022-02-10 at 00:29 +0900, Abhishek Bhola wrote: > > > I see there is an AUTOVACUUM job started on all the partitions that have > > > been > > > read (on which select has run). I am assuming the reason why Postgres is > > > autovacuuming these large partitions is this: > > > > > > db=# SE

Re: Why are data files getting modified?

2022-02-09 Thread Abhishek Bhola
I see, but then why is the autovacuum getting triggered after the select command? On Thu, Feb 10, 2022, 12:14 AM Laurenz Albe wrote: > On Wed, 2022-02-09 at 17:29 +0900, Abhishek Bhola wrote: > > I have a table with monthly partitions, starting from 2011. > > Each partition has about 2-3 billion

Re: Why are data files getting modified?

2022-02-09 Thread Laurenz Albe
On Wed, 2022-02-09 at 17:29 +0900, Abhishek Bhola wrote: > I have a table with monthly partitions, starting from 2011. > Each partition has about 2-3 billion rows and is about 40TB of data in total. > I am running a select query to \copy the data into csv files for each month. > > I see there is a

Re: Compile 14.1 in EL5.8

2022-02-09 Thread Tom Lane
Gabriela Serventi writes: > Hi! I'm trying to compile release 14.1 in a very old Linux Server (Red Hat > Enterprise Linux Server release 5.8). I can run configure successfully, but > when I try to run make, I get the following error: > latch.c:85:26: error: sys/signalfd.h: No such file or director

Re: Locks on FK Tables From Partitioning

2022-02-09 Thread Simon Riggs
On Tue, 8 Feb 2022 at 23:13, Tom Lane wrote: > > Aaron Sipser writes: > > I am fairly confused about the locks generated by some partitioning code I > > am using. The setup is that we have a partitioned table (call it P), and it > > has a foreign key constraint to another table F. I'm trying to f

Compile 14.1 in EL5.8

2022-02-09 Thread Gabriela Serventi
Hi! I'm trying to compile release 14.1 in a very old Linux Server (Red Hat Enterprise Linux Server release 5.8). I can run configure successfully, but when I try to run make, I get the following error: latch.c:85:26: error: sys/signalfd.h: No such file or directory Does anybody know if it is poss

Why are data files getting modified?

2022-02-09 Thread Abhishek Bhola
I have a table with monthly partitions, starting from 2011. Each partition has about 2-3 billion rows and is about 40TB of data in total. I am running a select query to \copy the data into csv files for each month. I see there is an *AUTOVACUUM* job started on all the partitions that have been rea