Re: [GENERAL] Rule Question

2013-07-25 Thread Sergey Konoplev
On Wed, Jul 24, 2013 at 11:44 PM, Andrew Bartley wrote: > Hope this question is not too stupid but.. > > I am trying to do something like this > > create table cats (a text,b text); > > create rule cats_test as on update to cats do set a = new.b; > > Can i manipulate column "a" sort of like th

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Vincenzo Romano
2013/7/25 Luca Ferrari : > On Thu, Jul 25, 2013 at 2:57 AM, Some Developer > wrote: >> The added advantage of removing load from the app servers so they can >> actually deal with serving the app is a bonus. > > Uhm...I don't know what application you are developing, but I don't > buy your explaina

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Pavel Stehule
2013/7/25 Vincenzo Romano : > 2013/7/25 Luca Ferrari : >> On Thu, Jul 25, 2013 at 2:57 AM, Some Developer >> wrote: >>> The added advantage of removing load from the app servers so they can >>> actually deal with serving the app is a bonus. >> >> Uhm...I don't know what application you are develop

Re: [GENERAL] Rule Question

2013-07-25 Thread Luca Ferrari
On Thu, Jul 25, 2013 at 8:44 AM, Andrew Bartley wrote: > create rule cats_test as on update to cats do set a = new.b; > I would use a column trigger attached to the 'a' column. Rules are better for query rewriting rather than from semantic changes. That's my opinion. Luca -- Sent via pgsql-g

Re: [GENERAL] Tablespace on Postgrsql

2013-07-25 Thread Luca Ferrari
On Thu, Jul 25, 2013 at 2:53 AM, devonline wrote: > Our current database size is > > 1 Terabyte > The idea behind tablespaces is to gain I/O scattering data (and therefore requests) across different devices. Therefore you have to identify first if your database can be "scattered" across different

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Some Developer
On 25/07/13 07:57, Luca Ferrari wrote: On Thu, Jul 25, 2013 at 2:57 AM, Some Developer wrote: The added advantage of removing load from the app servers so they can actually deal with serving the app is a bonus. Uhm...I don't know what application you are developing, but I don't buy your expla

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Some Developer
On 25/07/13 08:14, Vincenzo Romano wrote: 2013/7/25 Luca Ferrari : On Thu, Jul 25, 2013 at 2:57 AM, Some Developer wrote: The added advantage of removing load from the app servers so they can actually deal with serving the app is a bonus. Uhm...I don't know what application you are developin

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Bèrto ëd Sèra
Hi, >the whole design of this application is asynchronous in nature. Then you'll be MUCH better off with SPs, from an architectural POV, as you can basically design "building blocks" by initially just making SPs that deliver a mock result, and have the entire development of the app server being in

Re: [GENERAL] postgresql93-devel-9.3beta2-1PGDG.rhel5.x86_64 missed pg_config

2013-07-25 Thread Samrat Revagade
>I installed postgreSQL 9.3 beta 2 from http://yum.postgresql.org/repopackages.php#pg92 following >http://www.postgresonline.com/journal/archives/203-postgresql90-yum.html There are 2 possibilities for this error: 1. You have not included path of PostgreSQL's bin directory in environment variable

Re: [GENERAL] postgresql93-devel-9.3beta2-1PGDG.rhel5.x86_64 missed pg_config

2013-07-25 Thread Devrim GÜNDÜZ
Hi, On Fri, 2013-07-05 at 17:47 +0800, guxiaobo1982 wrote: > I installed postgreSQL 9.3 beta 2 from > http://yum.postgresql.org/repopackages.php#pg92 following > http://www.postgresonline.com/journal/archives/203-postgresql90-yum.html > > > But I cann't find pg_config, is this a bug? Did you i

Re: [GENERAL] Rule Question

2013-07-25 Thread Giuseppe Broccolo
I am trying to do something like this create table cats (a text,b text); create rule cats_test as on update to cats do set a = new.b; Can i manipulate column "a" sort of like this... or is there a better way. I think the easiest way to do this is to use a trigger like this: CREATE FUNCTI

Re: [GENERAL] Rule Question

2013-07-25 Thread Luca Ferrari
The original post was related to the update of b, so I guess it is better to limit the trigger scope to update on such column: CREATE OR REPLACE FUNCTION b_mirror() RETURNS TRIGGER AS $mirror$ BEGIN NEW.a = NEW.b; RETURN NEW; END; $mirror$ LANGUAGE plpgsql; CREATE TRIGGER tr_b_mirror AFTER

[GENERAL] Re: Postgres 9.2.4 for Windows (Vista) Dell Vostro 400, re-installation failure (re-sent, shorter)

2013-07-25 Thread sachin kotwal
Its looks like your previous un-installation was not done properly. Uninstall it properly first then restart your system. check pre-requisite for postgresql if any. then install Postgres 9.2.4. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Postgres-9-2-4-for-Wi

Re: [GENERAL] Rule Question

2013-07-25 Thread Tom Lane
Luca Ferrari writes: > The original post was related to the update of b, so I guess it is > better to limit the trigger scope to update on such column: > CREATE OR REPLACE FUNCTION b_mirror() RETURNS TRIGGER AS > $mirror$ > BEGIN > NEW.a = NEW.b; > RETURN NEW; > END; > $mirror$ LANGUAGE plp

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread V S P
I do not see why stored procedures are particular better for asynchronous application design. this can be done, as some pointed before, using standard libraries. Furthermore, while this does not apply to databases that do not burden users with heavy per-cpu costs, for many companies that build

Re: [GENERAL] Rule Question

2013-07-25 Thread Luca Ferrari
On Thu, Jul 25, 2013 at 3:02 PM, Tom Lane wrote: > Luca Ferrari writes: >> The original post was related to the update of b, so I guess it is >> better to limit the trigger scope to update on such column: > >> CREATE OR REPLACE FUNCTION b_mirror() RETURNS TRIGGER AS >> $mirror$ >> BEGIN >> NEW

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Steve Atkins
On Jul 25, 2013, at 1:44 AM, Some Developer wrote: >> > > When I was talking about improving speed I was talking about reducing load on > the app servers by putting more of the work load on the database server. I > know that it won't actually save CPU cycles (one of the machines has to do >

[GENERAL] group by query plan on already clustered index

2013-07-25 Thread Sandeep Gupta
On a table T with two fields, f1 and f2, the sql command select count(f2), f1 from T group by f1 result is seq scan followed by a sort on f1 (see the query plan below): GroupAggregate (cost=21566127.88..22326004.09 rows=987621 width=8) -> Sort (cost=21566127.88..21816127.88 rows=10

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Pavel Stehule
2013/7/25 Steve Atkins : > > On Jul 25, 2013, at 1:44 AM, Some Developer wrote: >>> >> >> When I was talking about improving speed I was talking about reducing load >> on the app servers by putting more of the work load on the database server. >> I know that it won't actually save CPU cycles (on

Re: [GENERAL] group by query plan on already clustered index

2013-07-25 Thread Pavel Stehule
Hello 2013/7/25 Sandeep Gupta : > On a table T with two fields, f1 and f2, the sql command > > select count(f2), f1 > from T > group by f1 > > result is seq scan followed by a sort on f1 (see the query plan below): > >GroupAggregate (cost=21566127.88..22326004.09 rows=987621 width=8) >->

Re: [GENERAL] Rule Question

2013-07-25 Thread bricklen
On Thu, Jul 25, 2013 at 4:18 AM, Giuseppe Broccolo < giuseppe.brocc...@2ndquadrant.it> wrote: > (TG_OP = 'UPDATE' AND > (NEW.b != OLD.b OR > (NEW.b IS NULL AND OLD.b IS NOT NULL) OR > (NEW.b IS NOT NULL AND OLD.b IS NULL) >

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Gauthier, Dave
I have a DB that relies heavily on recursive stored procedures that tap reflexive tables that store hierarchical data. These procedures are called from queries and return record streams. Temp tables are used to store collected data as the procedure runs up/down the hierarchy. And many other

[GENERAL] Speed up Switchover

2013-07-25 Thread TJ
Hi guys, I am looking for a way of speeding up the process of switching over of severs. At the moment we are switching over via the trigger file, reconfiguring our applications, patching or updating the old primary and rsyncing the data over to the old primary. I was wondering if there was an

Re: [GENERAL] Rule Question

2013-07-25 Thread Giuseppe Broccolo
Unrelated to the OP's question, the suggestion above could be more simply rewritten as TG_OP = 'UPDATE' AND NEW.b IS DISTINCT FROM OLD.b You're right! :) Giuseppe. -- Giuseppe Broccolo - 2ndQuadrant Italy PostgreSQL Training, Services and Support giuseppe.brocc...@2ndquadrant.it | www.2ndQu

Re: [GENERAL] Rule Question

2013-07-25 Thread Andrew Bartley
Thanks All, And thanks Tom, I did not realise a rule worked in that manner. Will now take that into account in the future. Thanks Andrew On 26 July 2013 02:02, Giuseppe Broccolo wrote: > > Unrelated to the OP's question, the suggestion above could be more simply >> rewritten as >> >> TG_OP

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Sébastien Lorion
On Thu, Jul 25, 2013 at 4:41 AM, Some Developer wrote: > You are forgetting that you can execute a query asynchronously using libpq > therefore the app server can continue serving requests whilst the database > server chugs away on its work. You just poll the server every now and again > to see if

[GENERAL] How to do incremental / differential backup every hour in Postgres 9.1?

2013-07-25 Thread Neil McGuigan
Trying to do an hourly hot incremental backup of a single postgres server (windows). I have the following setup in postgresql.conf: max_wal_senders=2 wal_level=archive archive_mode=on archive_command='copy "%p" "c:\\postgres\\archive\\%f"' I did a base backup with pg_basebackup -U postgres -D ..\

[GENERAL] Fastest Index/Algorithm to find similar sentences

2013-07-25 Thread Janek Sendrowski
Hi, I'm searching for an algorithm/Index to find similar sentences in a database. The Fulltextsearch is not really suitable because it doesn't have a tolerance. The Levenshtein-distance ist to slow. I also tried pg_trgm module, which works with tri-grams, but it's also very slow with 100.000+

[GENERAL] how _not_ to log?

2013-07-25 Thread Tim Spencer
Hello there! I've seen lots of people who have asked questions about how to log this or that, but I have the opposite question! :-) I'm seeing this in my logs: Jul 25 18:08:11 staging-db11 postgres[27050]: [10-2] STATEMENT: create role pguser encrypted password 'XXX'; Where

Re: [GENERAL] how _not_ to log?

2013-07-25 Thread Adrian Klaver
On 07/25/2013 03:59 PM, Tim Spencer wrote: Hello there! I've seen lots of people who have asked questions about how to log this or that, but I have the opposite question! :-) I'm seeing this in my logs: Jul 25 18:08:11 staging-db11 postgres[27050]: [10-2] STATEMENT: create role pgu

Re: [GENERAL] Why are stored procedures looked on so negatively?

2013-07-25 Thread Neil Tiffin
On Jul 23, 2013, at 7:29 PM, Some Developer wrote: > I've done quite a bit of reading on stored procedures recently and the > consensus seems to be that you shouldn't use them unless you really must. Application architecture is a specific software engineering discipline. These types of genera

[GENERAL] trouble with pam building 9.3beta2

2013-07-25 Thread Rob Sargent
Should I just bail on PAM? My system: 3.2.0-49-generic #75-Ubuntu SMP Tue Jun 18 17:39:32 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux NAME="Ubuntu" VERSION="12.04.2 LTS, Precise Pangolin" My configuration: ./configure --prefix=/usr/local/pgsql-9.3b2 --with-python --with-openssl --with-pam --with-

Re: [GENERAL] Speed up Switchover

2013-07-25 Thread Sergey Konoplev
On Thu, Jul 25, 2013 at 1:03 AM, TJ wrote: > I am looking for a way of speeding up the process of switching over of > severs. > At the moment we are switching over via the trigger file, reconfiguring our > applications, patching or updating the old primary and rsyncing the data > over to the old p

Re: [GENERAL] Tablespace on Postgrsql

2013-07-25 Thread devonline
Thanks for the in formation. Can you please tell me what would be a scalable architecture? (using pg_default) or separate custom tablespaces -- View this message in context: http://postgresql.1045698.n5.nabble.com/Tablespace-on-Postgrsql-tp5765056p5765219.html Sent from the PostgreSQL - ge

Re: [GENERAL] Tablespace on Postgrsql

2013-07-25 Thread Atri Sharma
On Fri, Jul 26, 2013 at 7:21 AM, devonline wrote: > Thanks for the in formation. Can you please tell me what would be a scalable > architecture? (using pg_default) or separate custom tablespaces Putting too may tables in one tablespace can lead to confusion, to say the least. Keeping logically s

Re: [GENERAL] Fastest Index/Algorithm to find similar sentences

2013-07-25 Thread Dann Corbit
Of course, you can use regular expressions and LIKE. Without understanding the structure of your database, I don't know if that can be made efficient. For a collection of sentences, I suspect it would get complicated. It would probably be slow. I guess that what you want to do will be hard t

Re: [GENERAL] Tablespace on Postgrsql

2013-07-25 Thread John R Pierce
On 7/25/2013 10:16 PM, Atri Sharma wrote: On Fri, Jul 26, 2013 at 7:21 AM, devonline wrote: >Thanks for the in formation. Can you please tell me what would be a scalable >architecture? (using pg_default) or separate custom tablespaces Putting too may tables in one tablespace can lead to confu

Re: [GENERAL] Tablespace on Postgrsql

2013-07-25 Thread John R Pierce
On 7/24/2013 5:53 PM, devonline wrote: Our current database size is 1 Terabyte I would like to suggest that you pick a smaller system for your first experience with postgres, and work your way up to the big monster stuff after you've gained some experience. a terabyte database is a monste

Re: [GENERAL] Fastest Index/Algorithm to find similar sentences

2013-07-25 Thread Amit Langote
On Fri, Jul 26, 2013 at 7:54 AM, Janek Sendrowski wrote: > Hi, > > I'm searching for an algorithm/Index to find similar sentences in a database. > > The Fulltextsearch is not really suitable because it doesn't have a tolerance. > > The Levenshtein-distance ist to slow. > > I also tried pg_trgm mod

Re: [GENERAL] Speed up Switchover

2013-07-25 Thread Samrat Revagade
> secondary without having to rsync the data as it can take up to 10 hours. pg_rewind (https://github.com/vmware/pg_rewind) is what you need. But I think it has a problem regarding the hint bits which Robert Hass pointed out. You can still solve hint bit problem by enabling new checksum feature,

Re: [GENERAL] Speed up Switchover

2013-07-25 Thread Michael Paquier
On Fri, Jul 26, 2013 at 3:00 PM, Samrat Revagade wrote: > > secondary without having to rsync the data as it can take up to 10 hours. > > pg_rewind (https://github.com/vmware/pg_rewind) is what you need. > > But I think it has a problem regarding the hint bits which Robert Hass > pointed out. > Yo

Re: [GENERAL] Speed up Switchover

2013-07-25 Thread Sergey Konoplev
On Thu, Jul 25, 2013 at 11:00 PM, Samrat Revagade wrote: >>> secondary without having to rsync the data as it can take up to 10 hours. >> >> pg_rewind (https://github.com/vmware/pg_rewind) is what you need. > > But I think it has a problem regarding the hint bits which Robert Hass > pointed out. >

Re: [GENERAL] how _not_ to log?

2013-07-25 Thread Joe Van Dyk
On Thursday, July 25, 2013, Tim Spencer wrote: > Hello there! > > I've seen lots of people who have asked questions about how to log > this or that, but I have the opposite question! :-) I'm seeing this in my > logs: > > Jul 25 18:08:11 staging-db11 postgres[27050]: [10-2] STATEMENT: cr

Re: [GENERAL] Speed up Switchover

2013-07-25 Thread Andres Freund
On 2013-07-25 22:00:23 -0700, Sergey Konoplev wrote: > On Thu, Jul 25, 2013 at 1:03 AM, TJ wrote: > > I am looking for a way of speeding up the process of switching over of > > severs. > > At the moment we are switching over via the trigger file, reconfiguring our > > applications, patching or upd