[GENERAL] Database denormalization

2012-02-14 Thread JG
Hi I would like to ask weather PostgreSQL does database denormalization at runtime. That is, for example, if I have a normalized database and I use lots of querys that would run faster on a denormalized database, than will PostgreSQL create a denormalized version of the database for internal u

Re: [GENERAL] Database denormalization

2012-02-14 Thread Marti Raudsepp
On Mon, Feb 13, 2012 at 15:48, JG wrote: > I would like to ask weather PostgreSQL does database denormalization at > runtime. > > To specify further, the question is, can I count on PostgreSQL to denormalize > the database when it would be better for the performance, or should I always > denorm

Re: [GENERAL] [GENERA]: Postgresql-9.1.1 synchronous replication issue

2012-02-14 Thread Venkat Balaji
Hello, Disaster Recovery testing for Synchronous replication setup - When the standby site is down, transactions at the production site started hanging (this is after the successful setup of synchronous replication). We changed synchronous_commit to 'local' to over-come this situation. - No tr

Re: [GENERAL] Database denormalization

2012-02-14 Thread Albe Laurenz
JG wrote: > To specify further, the question is, can I count on PostgreSQL to denormalize the database when it > would be better for the performance, or should I always denormalize the database and all the querys > myself. PostgreSQL does not do such things automatically. You'll have to do so your

Re: [GENERAL] Let-bindings in SQL statements

2012-02-14 Thread Marti Raudsepp
On Sat, Feb 11, 2012 at 12:42, Jasen Betts wrote: > There is no need. now() is tagged as stable. it will only be executed once. > the planner will figure this out for you. Actually that's not always true. In index condition arguments, the expression would indeed be executed just once. But in filt

Re: [GENERAL] [GENERA]: Postgresql-9.1.1 synchronous replication issue

2012-02-14 Thread Adrian Klaver
On Tuesday, February 14, 2012 4:21:22 am Venkat Balaji wrote: > Hello, > > Disaster Recovery testing for Synchronous replication setup - > > When the standby site is down, transactions at the production site started > hanging (this is after the successful setup of synchronous replication). > > W

Re: [GENERAL] Database denormalization

2012-02-14 Thread Scott Marlowe
On Tue, Feb 14, 2012 at 6:27 AM, Albe Laurenz wrote: > A materialized view is actually a table that holds a (possibly > aggregated) > copy of data from elsewhere in the database. > > Apart from materialized views, you can denormalize for performance by > adding columns to tables that store a copy

Re: [GENERAL] pg_upgrade: out of memory

2012-02-14 Thread Bruce Momjian
On Mon, Feb 06, 2012 at 05:14:55PM -0500, deepak wrote: > Hi! > > While running pg_upgrade, on one instance, it ran out of memory during the > final stages of upgrade > (just before it starts to "link" old database files to new ones). > > > We are using Postgres 9.1.1, and I see that there were

[GENERAL] High checkpoint_segments

2012-02-14 Thread Jay Levitt
We need to do a few bulk updates as Rails migrations. We're a typical read-mostly web site, so at the moment, our checkpoint settings and WAL are all default (3 segments, 5 min, 16MB), and updating a million rows takes 10 minutes due to all the checkpointing. We have no replication or hot sta

Re: [GENERAL] psql latex and newlines

2012-02-14 Thread Bruce Momjian
On Mon, Feb 13, 2012 at 02:50:12PM +0100, Wim Bertels wrote: > On vr, 2012-02-10 at 19:25 -0500, Bruce Momjian wrote: > > On Mon, Dec 12, 2011 at 07:15:12PM +0100, Wim Bertels wrote: > > > Hallo, > > > > > > psql latex output format needs to differentiate between a newline and a > > > tabularnewli

Re: [GENERAL] [GENERA]: Postgresql-9.1.1 synchronous replication issue

2012-02-14 Thread Venkat Balaji
On Tue, Feb 14, 2012 at 8:09 PM, Adrian Klaver wrote: > On Tuesday, February 14, 2012 4:21:22 am Venkat Balaji wrote: > > Hello, > > > > Disaster Recovery testing for Synchronous replication setup - > > > > When the standby site is down, transactions at the production site > started > > hanging (t

[GENERAL] Postgresql 9.0.6 backends pruning process environment?

2012-02-14 Thread dennis jenkins
djenkins@ostara ~/code/capybara $ psql -U$someuser -dpostgres -c "select version();" version -- PostgreSQL 9.

Re: [GENERAL] [GENERA]: Postgresql-9.1.1 synchronous replication issue

2012-02-14 Thread Venkat Balaji
On Wed, Feb 15, 2012 at 11:01 AM, Venkat Balaji wrote: > > On Tue, Feb 14, 2012 at 8:09 PM, Adrian Klaver wrote: > >> On Tuesday, February 14, 2012 4:21:22 am Venkat Balaji wrote: >> > Hello, >> > >> > Disaster Recovery testing for Synchronous replication setup - >> > >> > When the standby site is

[GENERAL] Easy form of "insert if it isn't already there"?

2012-02-14 Thread Chris Angelico
Periodically I find myself wanting to insert into some table, specifying the primary key column(s), but to simply ignore the request if it's already there. Currently I have two options: 1) Do the insert as normal, but suppress errors. SAVEPOINT foo; INSERT INTO table (col1,col2,col3) VALUES (val1,

Re: [GENERAL] High checkpoint_segments

2012-02-14 Thread Venkat Balaji
On Wed, Feb 15, 2012 at 1:35 AM, Jay Levitt wrote: > We need to do a few bulk updates as Rails migrations. We're a typical > read-mostly web site, so at the moment, our checkpoint settings and WAL are > all default (3 segments, 5 min, 16MB), and updating a million rows takes 10 > minutes due to

Re: [GENERAL] Easy form of "insert if it isn't already there"?

2012-02-14 Thread Bartosz Dmytrak
Hi, similar topic is in NOVICE mailing list: http://archives.postgresql.org/pgsql-novice/2012-02/msg00034.php e.g. You can use BEGIN... EXCEPTION END, good example of such approach is there: http://www.postgresql.org/docs/9.1/static/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE ; Reg

Re: [GENERAL] Easy form of "insert if it isn't already there"?

2012-02-14 Thread Chris Angelico
On Wed, Feb 15, 2012 at 5:26 PM, Bartosz Dmytrak wrote: > Hi, > similar topic is in NOVICE mailing > list: http://archives.postgresql.org/pgsql-novice/2012-02/msg00034.php > > e.g. You can use BEGIN... EXCEPTION END, good example of > such approach is > there: http://www.postgresql.org/docs/9.

Re: [GENERAL] High checkpoint_segments

2012-02-14 Thread Scott Marlowe
On Tue, Feb 14, 2012 at 10:57 PM, Venkat Balaji wrote: > > On Wed, Feb 15, 2012 at 1:35 AM, Jay Levitt wrote: >> >> We need to do a few bulk updates as Rails migrations.  We're a typical >> read-mostly web site, so at the moment, our checkpoint settings and WAL are >> all default (3 segments, 5 m

Re: [GENERAL] Easy form of "insert if it isn't already there"?

2012-02-14 Thread Bartosz Dmytrak
Yes it is. You can implement trigger on table to check if inserted record is new. Still it is on DB side. I don't know PHP well enough but I think You can call function e.g. SELECT myschema."InsertWhenNew" ("val1", "val2", "val3"); in the same way as You call INSERTS Regards, Bartek 2012/2/15 Ch