Re: [GENERAL] How to create unique index on multiple columns where the combination doesn't matter?

2017-03-23 Thread Glen Huang
Yes, the order doesn't matter, and this approach sounds like a good idea. I'll try it out, thanks. > On 23 Mar 2017, at 3:56 PM, Alban Hertroys wrote: > >> >> On 22 Mar 2017, at 17:54, Glen Huang wrote: >> >> Hello, >> >> If I have a table like >> >> CREATE TABLE relationship ( >> obj1 INT

Re: [GENERAL] Lag in asynchronous replication

2017-03-23 Thread Michael Paquier
On Fri, Mar 24, 2017 at 3:11 PM, Subhankar Chattopadhyay wrote: > Are you asking to have slave with synchronous replication? (top-posting is annoying) No, slaves cannot do synchronous replication. I am just telling that once you are sure that a sync state has been achieved on the master, you hav

Re: [GENERAL] Lag in asynchronous replication

2017-03-23 Thread Subhankar Chattopadhyay
Hi Michael, Are you asking to have slave with synchronous replication? Regards, SUBHANKAR CHATTOPADHYAY On 24 Mar 2017 09:33, "Michael Paquier" wrote: > On Thu, Mar 23, 2017 at 11:37 PM, Subhankar Chattopadhyay > wrote: > > in case of automated failover i want to check if slave is lagging fro

Re: [GENERAL] Lag in asynchronous replication

2017-03-23 Thread Michael Paquier
On Thu, Mar 23, 2017 at 11:37 PM, Subhankar Chattopadhyay wrote: > in case of automated failover i want to check if slave is lagging from > master and only if it is in sync, i want to do failover. But I am working in > a virtual cloud environment so by that time the master VM may not be > availabl

Re: [GENERAL] pg_last_xact_replay_timestamp() sometimes reports unlikely, very large delays

2017-03-23 Thread Toby Corkindale
- Original Message - > > On Mar 22, 2017, at 8:06 PM, Toby Corkindale > > wrote: > > > > My best guess for what is going on is: > > - There has been no activity for hours or days, and so the oldest replayed > > transaction on the slave is genuinely quite old. > > - Something has happened

Re: [GENERAL] pg_last_xact_replay_timestamp() sometimes reports unlikely, very large delays

2017-03-23 Thread John DeSoi
> On Mar 22, 2017, at 8:06 PM, Toby Corkindale > wrote: > > My best guess for what is going on is: > - There has been no activity for hours or days, and so the oldest replayed > transaction on the slave is genuinely quite old. > - Something has happened on the master that causes its > pg_curr

Re: [GENERAL] Run statements before pg_dump in same transaction?

2017-03-23 Thread Adrian Klaver
On 03/23/2017 12:06 PM, François Beausoleil wrote: Hi all! For development purposes, we dump the production database to local. It's fine because the DB is small enough. The company's growing and we want to reduce risks. To that end, we'd like to anonymize the data before it leaves the databas

Re: [GENERAL] audit function and old.column

2017-03-23 Thread Adrian Klaver
On 03/23/2017 02:00 PM, Armand Pirvu (home) wrote: Try number two. Hello I am using in a project the audit trigger from the wiki Witch one? (It seems the other spelling is banned) One particular aspect is that not all tables that I am after have the same columns . And it is one in particu

Re: [GENERAL] Run statements before pg_dump in same transaction?

2017-03-23 Thread Alban Hertroys
> On 23 Mar 2017, at 20:23, John R Pierce wrote: > > On 3/23/2017 12:06 PM, François Beausoleil wrote: >> For development purposes, we dump the production database to local. It's >> fine because the DB is small enough. The company's growing and we want to >> reduce risks. To that end, we'd lik

[GENERAL] audit function and old.column

2017-03-23 Thread Armand Pirvu (home)
Hello I am using in a project the audit trigger from the wiki One particular aspect is that not all tables that I am after have the same columns . And it is one in particular I am stumbling onto , and it ends i n _add_by. It can be group_add_by, car_add_by and so on. The old value of this colu

Re: [GENERAL] Run statements before pg_dump in same transaction?

2017-03-23 Thread John R Pierce
On 3/23/2017 12:06 PM, François Beausoleil wrote: For development purposes, we dump the production database to local. It's fine because the DB is small enough. The company's growing and we want to reduce risks. To that end, we'd like to anonymize the data before it leaves the database server.

Re: [GENERAL] Run statements before pg_dump in same transaction?

2017-03-23 Thread John R Pierce
On 3/23/2017 12:06 PM, François Beausoleil wrote: BEGIN; UPDATE users SET email = 'dev+' || id || '@example.com', password_hash = '/* hash of "password" */', ...; -- launch pg_dump as usual, ensuring a ROLLBACK at the end -- pg_dump must run with the*same* connection, obviously -- if not alrea

[GENERAL] Run statements before pg_dump in same transaction?

2017-03-23 Thread François Beausoleil
Hi all! For development purposes, we dump the production database to local. It's fine because the DB is small enough. The company's growing and we want to reduce risks. To that end, we'd like to anonymize the data before it leaves the database server. One solution we thought of would be to run

Re: [GENERAL] Autoanalyze oddity

2017-03-23 Thread Peter J. Holzer
On 2017-03-05 12:01:07 +0100, Peter J. Holzer wrote: [...] > At the current rate of inserts, this threshold will be reached on > March 24nd. I'll check whether the table is analyzed then. It was (a little earlier than expected because pg_class.reltuples didn't increase in the meantime). h

Re: [GENERAL] [ANNOUNCE] postgresql-unit 3 released

2017-03-23 Thread Karsten Hilbert
On Thu, Mar 23, 2017 at 02:51:58PM +0100, Christoph Berg wrote: > postgresql-unit 3 released > -- > > The PostgreSQL "unit" extension provides a datatype for values using > the SI base types, and Bytes. > > Highlight in version 3 of the extension is the ability to define

[GENERAL] Lag in asynchronous replication

2017-03-23 Thread Subhankar Chattopadhyay
hi, in case of automated failover i want to check if slave ia lagging​ from master and only if it is in sync, i want to do failover. But I am working in a virtual cloud environment so by that time the master VM may not be available to me. How can i check the lag in that case ? Regards, SUBHANKAR

Re: [GENERAL] Checksum and Wal files

2017-03-23 Thread Stephen Frost
Greetings, * Poul Kristensen (bcc5...@gmail.com) wrote: > Are all files inclusive wal files added a checksum? WAL files include checksums, yes. The heap files in recent versions can also include checksums, but they don't by defualt. Currently, checksums can only be enabled at initdb-time, meani

[GENERAL] Checksum and Wal files

2017-03-23 Thread Poul Kristensen
Hi! Are all files inclusive wal files added a checksum? We will be doing regularly tests of recovery using checksums as the parameter of a succesfull recovery. Thanks Poul

Re: [GENERAL] Wiki editor privilege

2017-03-23 Thread Charles Clavadetscher
Thanks! On 03/23/2017 10:11 AM, Magnus Hagander wrote: > On Thu, Mar 23, 2017 at 7:57 AM, Charles Clavadetscher > mailto:clavadetsc...@swisspug.org>> wrote: > > Hello > > I would like to upload the slides of my presentation at Nordic PGDay > 2017. Could you please grant me edit privi

Re: [GENERAL] Wiki editor privilege

2017-03-23 Thread Magnus Hagander
On Thu, Mar 23, 2017 at 7:57 AM, Charles Clavadetscher < clavadetsc...@swisspug.org> wrote: > Hello > > I would like to upload the slides of my presentation at Nordic PGDay > 2017. Could you please grant me edit privilege on the wiki? > > My user name is cclavadetscher > Hi! Done. -- Magnus H

Re: [GENERAL] How to create unique index on multiple columns where the combination doesn't matter?

2017-03-23 Thread Alban Hertroys
> On 22 Mar 2017, at 17:54, Glen Huang wrote: > > Hello, > > If I have a table like > > CREATE TABLE relationship ( > obj1 INTEGER NOT NULL REFERENCES object, > obj2 INTEGER NOT NULL REFERENCES object, > obj3 INTEGER NOT NULL REFERENCES object, > ... > ) > > And I want to constrain that