Re: [GENERAL] re-using RETURNING

2009-11-15 Thread Andreas Kretschmer
Andreas Kretschmer akretsch...@spamfence.net wrote: A. Kretschmer andreas.kretsch...@schollglas.com wrote: Hi, just to be sure, it is still (8.4) not possible to use RETURNING within an other INSERT? Thx for all replies. It is not a really problem, i will write a benchmark to

[GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread undisclosed user
Hello everyone, I have hit a wall on completing a solution I am working on. Originally, the app used a db per user (on MyIsam)the solution did not fair so well in reliability and performance. I have been increasingly interested in Postgres lately. Currently, I have about 30-35k

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread John R Pierce
undisclosed user wrote: Hello everyone, I have hit a wall on completing a solution I am working on. Originally, the app used a db per user (on MyIsam)the solution did not fair so well in reliability and performance. I have been increasingly interested in Postgres lately. Currently, I

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread Jorge Godoy
Frank, I had the same questioning a while ago and another thing that made me think was the amount of data per user. In the end, I decided on using a single DB and single schema and add a clause to split everything by each customer (customer_id). I then added an index on that column and my code

Re: [GENERAL] Fast Search on Encrypted Feild

2009-11-15 Thread Alban Hertroys
On 14 Nov 2009, at 22:27, Naoko Reeves wrote: I have a encrypted column use encrypt function. Querying against this column is almost not acceptable – returning 12 rows took 25,908 ms. The query was simply Select decrypt(phn_phone_enc) FROM phn WHERE decrypt(phn_phone_enc,’xxx’,’xxx’) LIKE

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread Johan Nel
undisclosed user wrote: I have hit a wall on completing a solution I am working on. Originally, the app used a db per user (on MyIsam)the solution did not fair so well in reliability and performance. I have been increasingly interested in Postgres lately. Currently, I have about 30-35k

Re: [GENERAL] Fast Search on Encrypted Feild

2009-11-15 Thread Merlin Moncure
On Sat, Nov 14, 2009 at 5:08 PM, John R Pierce pie...@hogranch.com wrote: Naoko Reeves wrote: I have a encrypted column use encrypt function. Querying against this column is almost not acceptable – returning 12 rows took 25,908 ms. The query was simply Select decrypt(phn_phone_enc) FROM

Re: [GENERAL] Fast Search on Encrypted Feild

2009-11-15 Thread Naoko Reeves
As Alban pointed out encrypting the search value and compare stored encrypted value is very fast though it can't do LIKE search. After I received valuable input from Merlin, Bill and John, I did some research regarding search against encrypted field in general and as in everyone's advice, I must

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread Tom Lane
undisclosed user lovetodrinkpe...@gmail.com writes: I have hit a wall on completing a solution I am working on. Originally, the app used a db per user (on MyIsam)the solution did not fair so well in reliability and performance. I have been increasingly interested in Postgres lately.

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread Merlin Moncure
On Sun, Nov 15, 2009 at 1:28 AM, undisclosed user lovetodrinkpe...@gmail.com wrote: Hello everyone, I have hit a wall on completing a solution I am working on. Originally, the app used a db per user (on MyIsam)the solution did not fair so well in reliability and performance. I have been

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread Scott Marlowe
On Sun, Nov 15, 2009 at 11:54 AM, Merlin Moncure mmonc...@gmail.com wrote: Use schema.  Here's a pro tip: if you have any sql or pl/pgsql functions you can use the same function body across all the schema as long as you discard the plans when you want to move from schema to schema. I too

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread John R Pierce
undisclosed user wrote: Currently, I have about 30-35k users/databases. The general table layout is the sameonly the data is different. I don't need to share data across databases. Very similar to a multi-tenant design. Do these users make their own arbitrary SQL queries?Or is all the

Re: [GENERAL] Voting: pg_ctl init versus initdb

2009-11-15 Thread Greg Smith
Zdenek Kotala wrote: 1) Yeah I like pg_ctl init pg_ctl init will be preferred method and initdb will disappear from usr/bin in the future. I agree with this position. My own database wrapper scripts work this way already, and it would be nice for them to have one more command

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread undisclosed user
If I were to switch to a single DB/single schema format shared among all users , how can I backup each user individually? Frank On Sat, Nov 14, 2009 at 10:28 PM, undisclosed user lovetodrinkpe...@gmail.com wrote: Hello everyone, I have hit a wall on completing a solution I am working on.

Re: [GENERAL] Experience with many schemas vs many databases

2009-11-15 Thread John R Pierce
undisclosed user wrote: If I were to switch to a single DB/single schema format shared among all users , how can I backup each user individually? depending on how many tables, etc, I suppose you could use a seperate series of SELECT statements ... but if this is a requirement, it certainly

Re: [GENERAL] Voting: pg_ctl init versus initdb

2009-11-15 Thread Simon Riggs
On Sat, 2009-11-14 at 15:07 +0100, Zdenek Kotala wrote: extend pg_ctl functionality and add init command which do same thing like initdb If we did add an extra option then the option would be initdb not init. It would take us all years to remove all evidence of the phrase initdb from the

[GENERAL] Config help

2009-11-15 Thread BuyAndRead Test
Hi I need some help with our postgresql.conf file. I would appreciate if someone could look at the values and tell me if it looks alright or if I need to change anything. The db server has 4 GB of memory and one quad core CPU (2,53 GHz). The hard drives is on a iSCSI array and is configured as

Re: [GENERAL] Voting: pg_ctl init versus initdb

2009-11-15 Thread Tom Lane
Simon Riggs si...@2ndquadrant.com writes: On Sat, 2009-11-14 at 15:07 +0100, Zdenek Kotala wrote: extend pg_ctl functionality and add init command which do same thing like initdb If we did add an extra option then the option would be initdb not init. It would take us all years to remove all

Re: [GENERAL] Config help

2009-11-15 Thread Scott Marlowe
On Sun, Nov 15, 2009 at 2:43 PM, BuyAndRead Test t...@buyandread.com wrote: Hi I need some help with our postgresql.conf file. I would appreciate if someone could look at the values and tell me if it looks alright or if I need to change anything. The db server has 4 GB of memory and one

Re: [GENERAL] Config help

2009-11-15 Thread BuyAndRead Test
Thanks for the quick and helpful reply. Yes, the storage array has a battery backed cache, it’s a Dell PowerVault MD3000i, with dual controllers. This is a virtual server, so I could give it as much as 8 GB of memory if this will give much higher performance. What should shared_buffere be set to

Re: [GENERAL] Config help

2009-11-15 Thread John R Pierce
BuyAndRead Test wrote: This is a virtual server, so I could give it as much as 8 GB of memory if this will give much higher performance. What should shared_buffere be set to if I use 8 GB, as much as 4 GB? I'd keep it around 1-2GB shared_buffers, and let the rest of the memory be used as

Re: [GENERAL] [pgeu-general] pgday.eu

2009-11-15 Thread Thom Brown
2009/11/14 Thom Brown thombr...@gmail.com: 2009/11/14 Thom Brown thombr...@gmail.com Mr Fetter has allowed me to post his lightning talk on lightning talks: http://vimeo.com/7602006 Thom Harald's lightning talk also available with his permission: http://vimeo.com/7610987 Thom Sorry, I've

[GENERAL] Triggering from a specific column update

2009-11-15 Thread Bob Pawley
PostgreSQL does not support specific column updates in triggers. I found this statement on a blog. Is there a workaround for this? I've attempted using 'new' (refering to the specific column) without success. Bob

Re: [GENERAL] Triggering from a specific column update

2009-11-15 Thread Tom Lane
Bob Pawley rjpaw...@shaw.ca writes: PostgreSQL does not support specific column updates in triggers. I found this statement on a blog. Is there a workaround for this? If you'd explain what you think that statement means, maybe we could help you ... regards, tom lane

Re: [GENERAL] Triggering from a specific column update

2009-11-15 Thread Bob Pawley
I'm trying to trigger from an update. However the trigger functions when any column has been updated. I have columns pump1 and pump2 and column serial. When pump1 is updated the trigger function performs properly. (one row is returned) When pump2 is updated the trigger function returns two

Re: [GENERAL] Triggering from a specific column update

2009-11-15 Thread Tom Lane
Bob Pawley rjpaw...@shaw.ca writes: Hope this elucidates you? No, it's all handwaving. In particular, showing only a fragment from a case that does work as you expect doesn't illuminate what's not working. Please show the whole table definition, the whole trigger, and the specific case that's

[GENERAL] When running pgsql2shp it truncates fields that are over 10 characters. How can I prevent this from occurring?

2009-11-15 Thread John Mitchell
When running pgsql2shp it truncates fields that are over 10 characters. How can I prevent this from occurring? John -- John J. Mitchell

Re: [GENERAL] Triggering from a specific column update

2009-11-15 Thread Adrian Klaver
On Sunday 15 November 2009 5:18:20 pm Tom Lane wrote: Bob Pawley rjpaw...@shaw.ca writes: Hope this elucidates you? No, it's all handwaving. In particular, showing only a fragment from a case that does work as you expect doesn't illuminate what's not working. Please show the whole table

Re: [GENERAL] Voting: pg_ctl init versus initdb

2009-11-15 Thread Greg Smith
Tom Lane wrote: Simon Riggs si...@2ndquadrant.com writes: If we did add an extra option then the option would be initdb not init. It would take us all years to remove all evidence of the phrase initdb from the mailing lists and our minds. init is already embedded in various packagers'

[GENERAL] money binary representation

2009-11-15 Thread Konstantin Izmailov
I'm trying to read money field using PQgetvalue (PostgreSQL 8.3.7). The function returns 9 bytes, smth like 0h 0h 0h 0h 0h 0h 14h 0h 0h, for the value '$50.2'. I could not find description anywhere on how to convert the binary data into, for example, a double precision number. Would you please

Re: [GENERAL] money binary representation

2009-11-15 Thread John R Pierce
Konstantin Izmailov wrote: I'm trying to read money field using PQgetvalue (PostgreSQL 8.3.7). The function returns 9 bytes, smth like 0h 0h 0h 0h 0h 0h 14h 0h 0h, for the value '$50.2'. I could not find description anywhere on how to convert the binary data into, for example, a double

Re: [GENERAL] money binary representation

2009-11-15 Thread Tom Lane
Konstantin Izmailov pgf...@gmail.com writes: I'm trying to read money field using PQgetvalue (PostgreSQL 8.3.7). The function returns 9 bytes, smth like 0h 0h 0h 0h 0h 0h 14h 0h 0h, for the value '$50.2'. I could not find description anywhere on how to convert the binary data into, for

Re: [GENERAL] money binary representation

2009-11-15 Thread Konstantin Izmailov
Right, the value is '$51.20'! Now I understand how to interpret the bytes - thank you! I had to work with an existing database and I do not know why they still use money fields. On Sun, Nov 15, 2009 at 9:38 PM, John R Pierce pie...@hogranch.com wrote: Konstantin Izmailov wrote: I'm trying to

[GENERAL] passing parameters to multiple statements

2009-11-15 Thread Konstantin Izmailov
I'm planning to use multiple statements via libpq. Before starting coding I'm trying to understand are there any limitations on passing parameters. E.g. would the following work: PQexecParams(conn, BEGIN;INSERT INTO tbl VALUES($1,$2);SELECT lastval();SELECT * INTO AUDIT FROM (SELECT $3, 'tbl