Re: [GENERAL] [HACKERS] PostgreSQL Core Team

2011-04-28 Thread Ashesh Vashi
Congrats Magnus!!! Thanks for the smart work and keep it up... -- Thanks Regards, Ashesh Vashi EnterpriseDB INDIA: Enterprise PostgreSQL Companyhttp://www.enterprisedb.com *http://www.linkedin.com/in/asheshvashi*http://www.linkedin.com/in/asheshvashi On Thu, Apr 28, 2011 at 12:18 AM, Dave

Re: [GENERAL] [ANNOUNCE] PostgreSQL Core Team

2011-04-28 Thread Stéphane A. Schildknecht
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Le 27/04/2011 20:48, Dave Page a écrit : I'm pleased to announce that effective immediately, Magnus Hagander will be joining the PostgreSQL Core Team. Magnus has been a contributor to PostgreSQL for over 12 years, and played a major part in the

[GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Thomas Larsen Wessel
I have a table with the following schema: CREATE TABLE foo (bar VARCHAR(32)); Every bar value has a format like a float, e.g. 2.5. Now I want that value multiplied by two and saved again as varchar. I was hoping to do smth like: UPDATE foo SET bar = TO_VARCHAR( TO_FLOAT(bar) * 2); --

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Dmitriy Igrishin
2011/4/28 Thomas Larsen Wessel mrve...@gmail.com I have a table with the following schema: CREATE TABLE foo (bar VARCHAR(32)); Every bar value has a format like a float, e.g. 2.5. Now I want that value multiplied by two and saved again as varchar. I was hoping to do smth like: UPDATE foo

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Szymon Guz
On 28 April 2011 11:26, Thomas Larsen Wessel mrve...@gmail.com wrote: I have a table with the following schema: CREATE TABLE foo (bar VARCHAR(32)); Every bar value has a format like a float, e.g. 2.5. Now I want that value multiplied by two and saved again as varchar. I was hoping to do smth

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Vibhor Kumar
On Apr 28, 2011, at 2:56 PM, Thomas Larsen Wessel wrote: UPDATE foo SET bar = TO_VARCHAR( TO_FLOAT(bar) * 2); -- INCORRECT If you are sure bar contains float value, then try following: UPDATE foo SET bar = bar::float * 2; Thanks Regards, Vibhor Kumar EnterpriseDB Corporation The

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Dmitriy Igrishin
2011/4/28 Vibhor Kumar vibhor.ku...@enterprisedb.com On Apr 28, 2011, at 2:56 PM, Thomas Larsen Wessel wrote: UPDATE foo SET bar = TO_VARCHAR( TO_FLOAT(bar) * 2); -- INCORRECT If you are sure bar contains float value, then try following: UPDATE foo SET bar = bar::float * 2; NB: I am

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Dmitriy Igrishin
2011/4/28 Thomas Larsen Wessel mrve...@gmail.com I have a table with the following schema: CREATE TABLE foo (bar VARCHAR(32)); Every bar value has a format like a float, e.g. 2.5. Now I want that value multiplied by two and saved again as varchar. I was hoping to do smth like: UPDATE foo

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Vibhor Kumar
On Apr 28, 2011, at 3:22 PM, Dmitriy Igrishin wrote: NB: I am sure that OP is not sure :-) And since foo.bar is varchar, it is better to use numeric instead of float :-) Now, this make to ask question, why numeric? How its better than float? Thanks Regards, Vibhor Kumar EnterpriseDB

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Dmitriy Igrishin
2011/4/28 Vibhor Kumar vibhor.ku...@enterprisedb.com On Apr 28, 2011, at 3:22 PM, Dmitriy Igrishin wrote: NB: I am sure that OP is not sure :-) And since foo.bar is varchar, it is better to use numeric instead of float :-) Now, this make to ask question, why numeric? How its better

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Vibhor Kumar
On Apr 28, 2011, at 3:41 PM, Dmitriy Igrishin wrote: Only one point, Vibhor. I believe that varchar data type was chosen for exact storage of numeric values. According to chapter 8.1.3 of the doc. for this case the usage of numeric is preferred over floating data types. Ah! Got it. This I

[GENERAL] plpython module import errors

2011-04-28 Thread c k
Hello, I have installed postgresql 9 on fedora 14 having python 2.7. Now created plpythonu language in my database and created a simple function to calculate sum of two variables. while importing math libbrary and executing the function i got the error PL/Python: ImportError: No module named cmath

Re: [GENERAL] GIN index not used

2011-04-28 Thread Oleg Bartunov
It should be better in 9.1 http://archives.postgresql.org/message-id/4c2ddc9b.1060...@sigaev.ru Oleg On Wed, 27 Apr 2011, Mark wrote: I have problem with GIN index. Queries over it takes a lot of time. Some informations: I've got a table with tsvector- textvector: CREATE TABLE

Re: [GENERAL] timestamp(0) vs. timestamp

2011-04-28 Thread Erwin Brandstetter
On 27.04.2011 19:36, Tom Lane wrote: Erwin Brandstetterbrsaw...@gmail.com writes: Hi all! This may seem unimportant, but I still would like to know. I have columns for timestamps without fractional digits, so I could define them as timestamp(0). However, there is no way fractions could ever

Re: [GENERAL] GIN index not used

2011-04-28 Thread Mark
Alban thanks for your quick reply. It is true that I use for this only 2,5GB RAM on Intel Core i5 CPU 2.67GHz and resources I didn't changed from instalation of postgres: max_connections = 100 shared_buffers = 32MB (other parameters are commented) , but that would not be the reason I think. I was

Re: [GENERAL] plpython module import errors

2011-04-28 Thread Sim Zacks
On 04/28/2011 02:19 PM, c k wrote: Hello, I have installed postgresql 9 on fedora 14 having python 2.7. Now created plpythonu language in my database and created a simple function to calculate sum of two variables. while importing math libbrary and executing the function i got the error

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Florian Weimer
* Michael Nolan: If you archive your WAL files, wouldn't that give you a pretty good indication of write activity? WAL archiving may increase WAL traffic considerably, I think. Fresh table contents (after CREATE TABLE or TRUNCATE) is written to the log if WAL archiving is active. This would

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Florian Weimer
* Greg Smith: To convert the internal numbers returned by that into bytes, you'll need to do some math on them. Examples showing how that works and code in a few languages: Thanks for the pointers. Those examples are slightly incongruent, but I think I've distilled something that should be

Re: [GENERAL] plpython module import errors

2011-04-28 Thread Martin Gainty
you will have to compensate for python's version-i*i*t*c behaviour by naming the binary to the exact version of python you are calling e.g. mv python python5 (for python version 5 binary) mv python python6 (for python version 6 binary) then in each of the bash scripts you are calling reference

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread David Boreham
One thing to remember in this discussion about SSD longevity is that the underlying value of interest is the total number of erase cycles, per block, on the flash devices. Vendors quote lifetime as a number of bytes, but this is calculated using an assumed write amplification factor. That

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Thomas Larsen Wessel
Thanks a lot :) Both of the following work UPDATE foo SET bar = (bar::float * 2); removes trailing zeros on the decimal side, if no decimals dont show any . UPDATE foo SET bar = (bar::numeric * 2); keeps decimals, i.e. 2.000 * 2 - 4.000 That leads me to two additional questions: 1) Can I

Re: [GENERAL] plpython module import errors

2011-04-28 Thread Karsten Hilbert
On Thu, Apr 28, 2011 at 09:15:06AM -0400, Martin Gainty wrote: mv python python5 (for python version 5 binary) mv python python6 (for python version 6 binary) Do you happen to mean 2.5 and 2.6 ? Given that, say, our Electronic Medical Record solution happily runs on Python 2.5, 2.6, and 2.7 I

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Dmitriy Igrishin
2011/4/28 Thomas Larsen Wessel mrve...@gmail.com Thanks a lot :) Both of the following work UPDATE foo SET bar = (bar::float * 2); removes trailing zeros on the decimal side, if no decimals dont show any . UPDATE foo SET bar = (bar::numeric * 2); keeps decimals, i.e. 2.000 * 2 - 4.000

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Dmitriy Igrishin
2011/4/28 Dmitriy Igrishin dmit...@gmail.com 2011/4/28 Thomas Larsen Wessel mrve...@gmail.com Thanks a lot :) Both of the following work UPDATE foo SET bar = (bar::float * 2); removes trailing zeros on the decimal side, if no decimals dont show any . UPDATE foo SET bar =

Re: [GENERAL] NULL saves disk space?

2011-04-28 Thread David Johnston
Doubtful but not sure; Boolean isn't that large a structure anyway... I'm not sure you'd want to introduce tri-value logic in this case anyway. If you know something is false why would you claim that you don't know what the value? Data should first and foremost be accurate and precise. In

Re: [GENERAL] plpython module import errors

2011-04-28 Thread c k
Yes, there are three version (now). I am aware of only 2.7 installed by default in /usr/lib directory and 3.2 which I have installed externally. But the function given above shows version 2.6.4. Now the question is how to change the version postresql is calling for function execution? I have also

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Scott Ribe
On Apr 28, 2011, at 7:21 AM, David Boreham wrote: I don't think you can simply say that I am writing so many Gb WAL files, therefore according to the vendor's spec Also, I fully expect the vendors lie about erase cycles as baldly as they lie about MTBF, so I would divide by a very healthy

Re: [GENERAL] plpython module import errors

2011-04-28 Thread Adrian Klaver
On Thursday, April 28, 2011 7:11:50 am c k wrote: Yes, there are three version (now). I am aware of only 2.7 installed by default in /usr/lib directory and 3.2 which I have installed externally. But the function given above shows version 2.6.4. Now the question is how to change the version

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread David Boreham
On 4/28/2011 8:20 AM, Scott Ribe wrote: I don't think you can simply say that I am writing so many Gb WAL files, therefore according to the vendor's spec Also, I fully expect the vendors lie about erase cycles as baldly as they lie about MTBF, so I would divide by a very healthy skepticism

Re: [GENERAL] NULL saves disk space?

2011-04-28 Thread Simon Riggs
On Wed, Apr 27, 2011 at 5:24 PM, Phoenix Kiula phoenix.ki...@gmail.com wrote: Possibly a dumb question but there isn't much about this. http://www.google.com/search?sourceid=chromeie=UTF-8q=postgresql+null+value+disk+space I have some BOOLEAN columns. 90% of the cases of the columns is FALSE.

Re: [GENERAL] NULL saves disk space?

2011-04-28 Thread Massa, Harald Armin
Do I save disk space by having them as NULL instead of FALSE? So my application would have conditional code for NULL and TRUE, instead of FALSE and TRUE. The short answer: do not even think about it. NULL has a well defined meaning within SQL: we do not know the value, with well defined

Re: [GENERAL] GIN index not used

2011-04-28 Thread Alban Hertroys
On 28 Apr 2011, at 10:07, Mark wrote: Alban thanks for your quick reply. It is true that I use for this only 2,5GB RAM on Intel Core i5 CPU 2.67GHz and resources I didn't changed from instalation of postgres: max_connections = 100 shared_buffers = 32MB (other parameters are commented) ,

Re: [GENERAL] [HACKERS] PostgreSQL Core Team

2011-04-28 Thread Roberto Mello
On Wed, Apr 27, 2011 at 2:48 PM, Dave Page dp...@postgresql.org wrote: I'm pleased to announce that effective immediately, Magnus Hagander will be joining the PostgreSQL Core Team. Well deserved. Congratulations! Roberto

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Alban Hertroys
On 28 Apr 2011, at 15:26, Thomas Larsen Wessel wrote: That leads me to two additional questions: 1) Can I specify how many decimals I want to be stored back from the result? E.g. 2 / 3 = 0. but I want to just save 0.66. 2) Can I make a criteria that it should only update on the

Re: [GENERAL] GIN index not used

2011-04-28 Thread Alban Hertroys
On 28 Apr 2011, at 17:29, Alban Hertroys wrote: With 2.5GB of memory (such a strange number) the docs suggest about 250MB. Correction, 25% of 2.5GB isn't 250MB of course. It would be somewhat over 500MB, although it's really just a rule-of-thumb (no point in calculating exact numbers). Anyway,

Re: [GENERAL] Converting between varchar and float when updating

2011-04-28 Thread Thomas Larsen Wessel
I appreciate the advice. But in this particular case, other people have decided for me that I should not change the schema. I guess they have their reasons :) On Thu, Apr 28, 2011 at 5:40 PM, Alban Hertroys dal...@solfertje.student.utwente.nl wrote: On 28 Apr 2011, at 15:26, Thomas Larsen

Re: [GENERAL] Switching Database Engines

2011-04-28 Thread Carlos Mennens
It seems that the 'mysql2postgres.pl' tool has instructions embedded into the file so I ran the command as instructed to take the output file and insert it into my PostgreSQL server and got the following error message: $ psql -p 5432 -h db1 -U wiki -f mediawiki_upgrade.pg Password for user wiki:

Re: [GENERAL] plpython module import errors

2011-04-28 Thread c k
Now, I found that python version postresql is using is 2.6 and path to it is

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Scott Ribe
On Apr 28, 2011, at 8:48 AM, David Boreham wrote: As a former card-carrying semiconductor company employee, I'm not so sure about this. Well, yes, you have a good point that in many, if not all, cases we're dealing with different companies. That really should have occurred to me, that

Re: [GENERAL] plpython module import errors

2011-04-28 Thread c k
Cheers! Solved. What I did is complied source with python option (it failed even giving correct python 3.2 as per instruction given in the manual page you have shown) for python 2.7. From build and installed postgresql, copied plpython2.so and plpython.so to the developement server and restarted

[GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Jim Irrer
A colleague of mine insists that using surrogate keys is the common practice by an overwhelming margin in relational databases and that they are used in 99 percent of large installations. I agree that many situations benefit from them, but are they really as pervasive as he claims? Thanks, -

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Andy Colson
On 4/28/2011 12:29 PM, Jim Irrer wrote: A colleague of mine insists that using surrogate keys is the common practice by an overwhelming margin in relational databases and that they are used in 99 percent of large installations. I agree that many situations benefit from them, but are they really

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Rob Sargent
On 04/28/2011 11:44 AM, Andy Colson wrote: On 4/28/2011 12:29 PM, Jim Irrer wrote: A colleague of mine insists that using surrogate keys is the common practice by an overwhelming margin in relational databases and that they are used in 99 percent of large installations. I agree that many

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Andrew Sullivan
On Thu, Apr 28, 2011 at 01:29:31PM -0400, Jim Irrer wrote: common practice by an overwhelming margin in relational databases and that they are used in 99 percent of large installations. 94.68536% of all the claims I ever hear are obviously pulled out of thin air. What conclusion does your

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Joshua D. Drake
On 04/28/2011 10:29 AM, Jim Irrer wrote: A colleague of mine insists that using surrogate keys is the common practice by an overwhelming margin in relational databases and that they are used in 99 percent of large installations. I agree that many situations benefit from them, but are they

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Scott Ribe
On Apr 28, 2011, at 11:53 AM, Rob Sargent wrote: Hm, I get the feeling that only the good folks at Hibernate seem to think using a natural key is the _only_ way to go. Well, natural keys are quite obviously the way to go, when they exist. The problem is, they usually don't really exist.

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Daniele Varrazzo
On Thu, Apr 28, 2011 at 7:26 PM, Joshua D. Drake j...@commandprompt.com wrote: Well there is no fact to back that up but, I will say that most toolkits require the use of a synthetic key, rails, django etc Usually such tools are born with surrogate keys only, because it's easier, and

Re: [GENERAL] [ANNOUNCE] [HACKERS] PostgreSQL Core Team

2011-04-28 Thread Ernesto Lozano
Excellent Notice Success for All Kind Best Regard Ernesto Lozano Director General Hia Technology de Venezuela ISV/ de EnterpriseDB for Venezuela , Colombia Member Community Postgresql Venezuela and Latin America www.hiatechnology.com.ve eloz...@hiatechnology.com.ve v...@postgresql.org Twitter:

[GENERAL] OLD. || myColumnNameVar (How to generically access columns in a trigger's OLD or NEW records)

2011-04-28 Thread Basil Bourque
In PL/pgSQL, how does one generically access the fields of the OLD or NEW record? I've tried code such as this: 'NEW.' || quote_ident( myColumnNameVar ) || '::varchar' But when run by an EXECUTE command, I get errors such as: ERROR: missing FROM-clause entry for table old SQL state:

Re: [GENERAL] OLD. || myColumnNameVar (How to generically access columns in a trigger's OLD or NEW records)

2011-04-28 Thread hubert depesz lubaczewski
On Thu, Apr 28, 2011 at 12:46:50PM -0700, Basil Bourque wrote: In PL/pgSQL, how does one generically access the fields of the OLD or NEW record? I've tried code such as this: 'NEW.' || quote_ident( myColumnNameVar ) || '::varchar' But when run by an EXECUTE command, I get errors such

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Robert Treat
On Thu, Apr 21, 2011 at 12:10 PM, Greg Smith g...@2ndquadrant.com wrote: On 04/21/2011 11:33 AM, Florian Weimer wrote: Is there an easy way to monitor WAL traffic in away? It does not have to be finegrained, but it might be helpful to know if we're doing 10 GB, 100 GB or 1 TB of WAL traffic

Re: [GENERAL] OLD. || myColumnNameVar (How to generically access columns in a trigger's OLD or NEW records)

2011-04-28 Thread John DeSoi
On Apr 28, 2011, at 3:46 PM, Basil Bourque wrote: It seems that I cannot get PL/pgSQL to interpret the text of NEW. + column name as text. My goal is to loop each field in a trigger, comparing the OLD. NEW. values of each field. If different I want to log both values in a

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Yeb Havinga
On 2011-04-28 21:34, Robert Treat wrote: We have an open task to work on this same problem. What we had cobbled together so far was some sql which converted the xlog value into an integer (it's pretty ugly, but I could send it over if you think it would help), which we could then stick in a

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Merlin Moncure
On Thu, Apr 28, 2011 at 12:29 PM, Jim Irrer ir...@umich.edu wrote: A colleague of mine insists that using surrogate keys is the common practice by an overwhelming margin in relational databases and that they are used in 99 percent of large installations.  I agree that many situations benefit

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread David Johnston
Any system that generates transactional data has to use some kind of synthetic key. I guess you could rely upon some form of timestamp but from a usability standpoint that is not really a good decision. Inventory also requires synthetic keys - whether you decide what they are or someone else

Re: [GENERAL] pervasiveness of surrogate (also called synthetic) keys

2011-04-28 Thread Karsten Hilbert
On Thu, Apr 28, 2011 at 03:39:19PM -0500, Merlin Moncure wrote: They are fairly pervasive, and increasingly so, which I find to be really unfortunate. Personally I think rote use of surrogate keys is terrible and leads to bad table designs, especially if you don't identify the true natural

Re: [GENERAL] New feature: skip row locks when table is locked.

2011-04-28 Thread Jeff Davis
On Thu, 2011-04-28 at 07:29 +0200, pasman pasmański wrote: Hi. Yesterday i have an idea, that sometimes row locks may be skipped, when table is already locked with LOCK command. It may to reduce an overhead from row locks. What do you think about it? The table-level lock mode would need to be

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Basil Bourque
Instead of the usual SSD, you may want to consider the 'ioDrive' products from Fusion-io. http://www.fusionio.com/ This company makes enterprise-class storage on a board populated with flash and managed by their own supposedly-sophisticated drivers. The board + drivers are meant to get around

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Mark Felder
On Thu, 28 Apr 2011 17:27:04 -0500, Basil Bourque basil.l...@me.com wrote: So, while I can't specifically recommend their products, I certainly suggest considering them. Customer of ours is probably lurking on here. We host their servers in our datacenter -- we had a UPS go pop after an

[GENERAL] schemas for organizing tables

2011-04-28 Thread Seb
Hi, A database I'm handling is becoming a bit large'ish (~ 30 tables), and I'd like to break them down into their natural units. Schemas for each of these natural units seems logical, but are they really meant for this? I'm also worried about how this would affect programs like Libreoffice (the

Re: [GENERAL] schemas for organizing tables

2011-04-28 Thread John R Pierce
On 04/28/11 5:51 PM, Seb wrote: Hi, A database I'm handling is becoming a bit large'ish (~ 30 tables), and I'd like to break them down into their natural units. Schemas for each of these natural units seems logical, but are they really meant for this? I'm also worried about how this would

Re: [GENERAL] schemas for organizing tables

2011-04-28 Thread Seb
On Thu, 28 Apr 2011 18:15:05 -0700, John R Pierce pie...@hogranch.com wrote: On 04/28/11 5:51 PM, Seb wrote: Hi, A database I'm handling is becoming a bit large'ish (~ 30 tables), and I'd like to break them down into their natural units. Schemas for each of these natural units seems

Re: [GENERAL] schemas for organizing tables

2011-04-28 Thread Darren Duncan
Seb wrote: A database I'm handling is becoming a bit large'ish (~ 30 tables), and I'd like to break them down into their natural units. Schemas for each of these natural units seems logical, but are they really meant for this? I'm also worried about how this would affect programs like

Re: [GENERAL] schemas for organizing tables

2011-04-28 Thread Seb
On Thu, 28 Apr 2011 19:29:11 -0700, Darren Duncan dar...@darrenduncan.net wrote: Seb wrote: A database I'm handling is becoming a bit large'ish (~ 30 tables), and I'd like to break them down into their natural units. Schemas for each of these natural units seems logical, but are they really

Re: [GENERAL] SSDs with Postgresql?

2011-04-28 Thread Toby Corkindale
On 22/04/11 01:33, Florian Weimer wrote: * Greg Smith: The fact that every row update can temporarily use more than 8K means that actual write throughput on the WAL can be shockingly large. The smallest customer I work with regularly has a 50GB database, yet they write 20GB of WAL every day.