[GENERAL] Row visibility issue with consecutive triggers, one being DEFERRED

2015-06-04 Thread Marc Mamin
Hello, The test below is running fine but if you add the trigger push_foo_tr (uncomment) then the exception is raised. It seems that this additional trigger to be called at the first place changes the deferrable status of the second one. Is this an expected behaviour ? regards, Marc Mamin

[GENERAL] pg_relation_size performance issue

2015-06-04 Thread Hans Guijt
I have a Postgres 9.3.7 database, freshly created on Ubuntu 14 LTS 64 bit, and at this time almost completely empty. I'm attempting to find the size of a table, using the following code: SELECT pg_relation_size (stat.relid), CASE WHEN cl.reltoastrelid = 0 THEN 0 ELSE pg_relation_size (

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Hans Guijt
...and I forgot to add: for the rest the database is behaving fine; everything else works without performance issues, even when we stepped up the amount of data somewhat. It's just this one query that is somehow very slow. Hans Guijt From: pgsql-general-ow...@postgresql.org [mailto:pgsql-ge

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Marc Mamin
> I have a Postgres 9.3.7 database, freshly created on Ubuntu 14 LTS 64 bit, > and at this time almost completely empty. I'm attempting to find the size of > a table, using the following code: > > SELECT > pg_relation_size (stat.relid), > CASE WHEN cl.reltoastrelid = 0 THEN > 0 > ELSE >

[GENERAL] Automatic Client routing

2015-06-04 Thread Ravi Krishna
Are there any plans to introduce the concept of automatic client routing to the principal server in a cluster of N machines. For example, if there is a four node replication cluster N1 .. N4, at any time only one can be principal (the one which does the writing). In Oracle and DB2, client side libr

[GENERAL] Re: Row visibility issue with consecutive triggers, one being DEFERRED

2015-06-04 Thread Marc Mamin
recall! this self containing case works well if I call the correct functions in the triggers :) Marc > -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Marc Mamin > Sent: Donnerstag, 4. Juni 2015 10:47 > To: pgsql

Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Robert Haas
On Thu, Jun 4, 2015 at 2:42 AM, Noah Misch wrote: > I like that change a lot. It's much easier to seek forgiveness for wasting <= > 28 GiB of disk than for deleting visibility information wrongly. I'm glad you like it. I concur. >> 2. If setting the offset stop limit (the point where we refuse

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Tom Lane
Hans Guijt writes: > I have a Postgres 9.3.7 database, freshly created on Ubuntu 14 LTS 64 bit, > and at this time almost completely empty. I'm attempting to find the size of > a table, using the following code: > SELECT > pg_relation_size (stat.relid), > CASE WHEN cl.reltoastrelid = 0 THEN

Re: [GENERAL] Row visibility issue with consecutive triggers, one being DEFERRED

2015-06-04 Thread Tom Lane
Marc Mamin writes: > The test below is running fine > but if you add the trigger push_foo_tr (uncomment) > then the exception is raised. Doesn't that trigger result in infinite recursion? > CREATE OR REPLACE FUNCTION push_foo_trf () returns trigger AS $$ > BEGIN > UPDATE foo SET (id,v) = (N

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Melvin Davidson
I'm not sure why you are adding toast to table size, since pg_relation_size already does that. http://www.postgresql.org/docs/9.3/interactive/functions-admin.html This query might work better and faster for you. SELECT n.nspname as schema, c.relname as table, a.rolname

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Melvin Davidson
Correction, pg_relation_size includes toast data. On Thu, Jun 4, 2015 at 10:03 AM, Melvin Davidson wrote: > I'm not sure why you are adding toast to table size, since > pg_relation_size already does that. > > http://www.postgresql.org/docs/9.3/interactive/functions-admin.html > > This query migh

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Melvin Davidson
Dammit pg_total_relation_size includes toast data. Thumb problems and to quick to hit send. :( On Thu, Jun 4, 2015 at 10:07 AM, Melvin Davidson wrote: > Correction, pg_relation_size includes toast data. > > On Thu, Jun 4, 2015 at 10:03 AM, Melvin Davidson > wrote: > >> I'm not sure why you are

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Hans Guijt
Thanks, this is most helpful. I originally found that query somewhere on the internet and used it as-is. If I drop the restriction on table name I get a list that also includes indexes, constraints, etc. Is there a way to restrict the returned set to tables only? Hans Guijt From: Melvin Da

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Melvin Davidson
Sorry, I left out AND relkind = 'r' will which restrict to just tables. On Thu, Jun 4, 2015 at 10:24 AM, Hans Guijt wrote: > Thanks, this is most helpful. I originally found that query somewhere on > the internet and used it as-is. > > > > If I drop the restriction on table name I get a list

Re: [GENERAL] pg_relation_size performance issue

2015-06-04 Thread Adrian Klaver
On 06/04/2015 07:24 AM, Hans Guijt wrote: Thanks, this is most helpful. I originally found that query somewhere on the internet and used it as-is. If I drop the restriction on table name I get a list that also includes indexes, constraints, etc. Is there a way to restrict the returned set to tab

Re: [GENERAL] Row visibility issue with consecutive triggers, one being DEFERRED

2015-06-04 Thread Marc Mamin
> -Original Message- > From: Tom Lane [mailto:t...@sss.pgh.pa.us] > Sent: Donnerstag, 4. Juni 2015 15:56 > To: Marc Mamin > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] Row visibility issue with consecutive triggers, > one being DEFERRED > > Marc Mamin writes: > > The test

[GENERAL] cannot connect to database through ECPG but can through psql

2015-06-04 Thread Seann Reed
I'm a relative newbie to Postgres but I've asked a few colleagues about this problem without a solution, so I'm hoping someone on the list serve can help. The problem arose when I move to an upgraded operating system, an upgraded version of Postgres, and when I dump a database out of the old machi

Re: [GENERAL] cannot connect to database through ECPG but can through psql

2015-06-04 Thread Andreas Kretschmer
Seann Reed wrote: > Everything worked fine with the old setup.  With the new setup, I can access > my > database through psql command-line.  However, I have a compiled program called > 'Shefdecode' that makes queries to the database through ECPG and this program > cannot access the database.  I

Re: [GENERAL] cannot connect to database through ECPG but can through psql

2015-06-04 Thread Tom Lane
Seann Reed writes: > I'm a relative newbie to Postgres but I've asked a few colleagues about > this problem without a solution, so I'm hoping someone on the list serve > can help. > The problem arose when I move to an upgraded operating system, an upgraded > version of Postgres, and when I dump a

Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Robert Haas
On Thu, Jun 4, 2015 at 9:42 AM, Robert Haas wrote: > Thanks for the review. Here's a new version. I've fixed the things Alvaro and Noah noted, and some compiler warnings about set but unused variables. I also tested it, and it doesn't quite work as hoped. If started on a cluster where oldestMu

[GENERAL] replicating many to one

2015-06-04 Thread Doiron, Daniel
I have a situation where I need to replicate the databases in 4 clusters on 4 individual servers to a single cluster on 1 server. So far, the best option looks like pgpool statement-based replication, the major down side being sequences. Does anyone know a better way to achieve this type of repl

Re: [HACKERS] Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Andres Freund
Hi, On 2015-06-04 12:57:42 -0400, Robert Haas wrote: > + /* > + * Do we need an emergency autovacuum? If we're not sure, assume yes. > + */ > + return !oldestOffsetKnown || > + (nextOffset - oldestOffset > MULTIXACT_MEMBER_SAFE_THRESHOLD); I think without teaching a

Re: [HACKERS] Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Robert Haas
On Thu, Jun 4, 2015 at 1:27 PM, Andres Freund wrote: > On 2015-06-04 12:57:42 -0400, Robert Haas wrote: >> + /* >> + * Do we need an emergency autovacuum? If we're not sure, assume yes. >> + */ >> + return !oldestOffsetKnown || >> + (nextOffset - oldestOffset > MULTI

Re: [HACKERS] Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Alvaro Herrera
Alvaro Herrera wrote: > Robert Haas wrote: > > > So here's a patch taking a different approach. > > I tried to apply this to 9.3 but it's messy because of pgindent. Anyone > would have a problem with me backpatching a pgindent run of multixact.c? Done. -- Álvaro Herrerahttp://

Re: [GENERAL] replicating many to one

2015-06-04 Thread Wayne E. Seguin
Take a good look at http://2ndquadrant.com/en/resources/bdr/ On Thu, Jun 4, 2015 at 1:07 PM, Doiron, Daniel wrote: > I have a situation where I need to replicate the databases in 4 clusters > on 4 individual servers to a single cluster on 1 server. So far, the best > option looks like pgpool st

Re: [GENERAL] replicating many to one

2015-06-04 Thread John R Pierce
On 6/4/2015 10:07 AM, Doiron, Daniel wrote: I have a situation where I need to replicate the databases in 4 clusters on 4 individual servers to a single cluster on 1 server. So far, the best option looks like pgpool statement-based replication, the major down side being sequences. Does anyone k

Re: [GENERAL] replicating many to one

2015-06-04 Thread Doiron, Daniel
The four source/master servers all have different databases, lets call them A, B, C, and D. We'd like to replicate them to one cluster that will hold ABCD databases. -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John

Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Robert Haas
On Thu, Jun 4, 2015 at 12:57 PM, Robert Haas wrote: > On Thu, Jun 4, 2015 at 9:42 AM, Robert Haas wrote: >> Thanks for the review. > > Here's a new version. I've fixed the things Alvaro and Noah noted, > and some compiler warnings about set but unused variables. > > I also tested it, and it does

Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Robert Haas
On Thu, Jun 4, 2015 at 5:29 PM, Robert Haas wrote: > - Forces aggressive autovacuuming when the control file's > oldestMultiXid doesn't point to a valid MultiXact and enables member > wraparound at the next checkpoint following the correction of that > problem. Err, enables member wraparound *pro

Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Thomas Munro
On Fri, Jun 5, 2015 at 9:29 AM, Robert Haas wrote: > Here's a new version with some more fixes and improvements: > > - SetOffsetVacuumLimit was failing to set MultiXactState->oldestOffset > when the oldest offset became known if the now-known value happened to > be zero. Fixed. > > - SetOffsetVac

Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Thomas Munro
On Fri, Jun 5, 2015 at 11:47 AM, Thomas Munro wrote: > On Fri, Jun 5, 2015 at 9:29 AM, Robert Haas wrote: >> Here's a new version with some more fixes and improvements: >> >> - SetOffsetVacuumLimit was failing to set MultiXactState->oldestOffset >> when the oldest offset became known if the now-k

Re: [GENERAL] Automatic Client routing

2015-06-04 Thread Bill Moran
On Thu, 4 Jun 2015 08:53:15 -0400 Ravi Krishna wrote: > Are there any plans to introduce the concept of automatic client > routing to the principal server in a cluster of N machines. For > example, if there is a four node replication cluster N1 .. N4, at any > time only one can be principal (the

Re: [GENERAL] replicating many to one

2015-06-04 Thread Sergey Konoplev
On Thu, Jun 4, 2015 at 12:14 PM, Doiron, Daniel wrote: > The four source/master servers all have different databases, lets call them > A, B, C, and D. We'd like to replicate them to one cluster that will hold > ABCD databases. You can use londiste [1] or slony [2] to do that. [1] http://skytoo

Re: [GENERAL] Database designpattern - product feature

2015-06-04 Thread William Dunn
Hello Adrian, Sorry for the late response. I've not used Django so I can't provide specific guidance on how you would implement it with that but in SQLAlchemy that model is called "joined-table-inheritance": http://docs.sqlalchemy.org/en/latest/orm/inheritance.html#joined-table-inheritance That i

Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1

2015-06-04 Thread Noah Misch
On Thu, Jun 04, 2015 at 05:29:51PM -0400, Robert Haas wrote: > Here's a new version with some more fixes and improvements: I read through this version and found nothing to change. I encourage other hackers to study the patch, though. The surrounding code is challenging. > With this version, I'm