Re: [GENERAL] Performance tuning in Pgsql

2010-12-15 Thread Rodger Donaldson
On Fri, Dec 10, 2010 at 01:55:14AM -0700, Scott Marlowe wrote: > > OK, so the way I do this, is to locate my data directory. On a stock > Ubuntu machine that would be /var/lib/postgresql/8.4/main . In that > dir is a directory called pg_xlog, what we're looking for. So, as > root, I'd do: > >

[GENERAL] Postgres Installation

2010-12-15 Thread Adarsh Sharma
Dear all, Is there are any useful links for Installing Postgres_9.1 (recent version ) in CentOS from its binaries. Thanks. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] INSERT INTO...RETURNING with partitioned table based on trigger function

2010-12-15 Thread pgsql . 30 . miller_2555
Hi - Issue: How to return a sequence value generated upon INSERT of records into a partitioned table using trigger functions (without having to insert into the child table directly). Current implementation: The master table of the partitioned table uses a trigger function to alter an inco

Re: [GENERAL] [HACKERS] getting composite types info from libpq

2010-12-15 Thread Daniele Varrazzo
On Wed, Dec 15, 2010 at 6:56 PM, Merlin Moncure wrote: > On Wed, Dec 15, 2010 at 1:25 PM, Daniele Varrazzo > wrote: >> Hello, >> >> when a query returns a composite type, the libpq PQftype() function >> reports the oid of the "record" type. In psycopg: >> >>    >>> cur.execute("select (1,2)") >>

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Adrian Klaver
On Wednesday 15 December 2010 11:55:24 am Andrus Moor wrote: > > I got to thinking more about this. How are the databases administered? In > > other > > words how are they started/stopped, upgraded, logs read, etc? > > Databases are working many years in 24x7 mode without administration. > For ever

Re: [GENERAL] Changing table owner to db owner.

2010-12-15 Thread Radosław Smogura
Try this: 1. Open psql console as user postgres. 2. Execute SELECT ('\\c ' || datname || '\nALTER TABLE the_table_name OWNER TO ' || rolname || ';\n') from pg_database join pg_authid on datdba = pg_authid.oid; 3. Check results. 4. Select results with mouse. 5. Paste it to postgres console (Middle

Re: [GENERAL] What is the name pseudo column

2010-12-15 Thread David Fetter
On Wed, Dec 15, 2010 at 03:43:45PM -0800, Adrian Klaver wrote: > On Wednesday 15 December 2010 1:27:19 pm David Fetter wrote: > > On Wed, Dec 15, 2010 at 01:50:54PM -0600, Jack Christensen wrote: > > > I was just surprised when accidentally selecting a non-existent name > > > column there was no er

Re: [GENERAL] What is the name pseudo column

2010-12-15 Thread Adrian Klaver
On Wednesday 15 December 2010 1:27:19 pm David Fetter wrote: > On Wed, Dec 15, 2010 at 01:50:54PM -0600, Jack Christensen wrote: > > I was just surprised when accidentally selecting a non-existent name > > column there was no error -- instead something came back. > > > > select accounts.name from a

[GENERAL] Autovacuum running although set to off, and wraparound limit has not been reached

2010-12-15 Thread Paolo Saul
POSTGRESQL version 8.3.5 Centos5 x64 #-- # AUTOVACUUM PARAMETERS #-- autovacuum = off# Enable autovacuum subprocess? 'on

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Guillaume Lelarge
Le 15/12/2010 17:26, Adrian Klaver a écrit : > On 12/15/2010 07:34 AM, Andrus Moor wrote: >>> No, this is just pilot error. Any version of pg_dump will produce >>> output that is meant to be loaded into the matching server version >>> (or a later version). If you are intending to load back into 8.4

Re: [GENERAL] What is the name pseudo column

2010-12-15 Thread David Fetter
On Wed, Dec 15, 2010 at 01:50:54PM -0600, Jack Christensen wrote: > I was just surprised when accidentally selecting a non-existent name > column there was no error -- instead something came back. > > select accounts.name from accounts limit 1 -> > (1,65522,1,0.00,,"2010-07-22 09:57:26.281172-05",

Re: [GENERAL] Changing table owner to db owner.

2010-12-15 Thread Radosław Smogura
Try this: 1. Open psql console as user postgres. 2. Execute SELECT ('\\c ' || datname || '\nALTER TABLE the_table_name OWNER TO ' || rolname || ';\n') from pg_database join pg_authid on datdba = pg_authid.oid; 3. Check results. 4. Select results with mouse. 5. Paste it to postgres console (Midd

[GENERAL] What is the name pseudo column

2010-12-15 Thread Jack Christensen
I was just surprised when accidentally selecting a non-existent name column there was no error -- instead something came back. select accounts.name from accounts limit 1 -> (1,65522,1,0.00,,"2010-07-22 09:57:26.281172-05",2) It appears it tries to return the entire row in an array (but longer

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Andrus Moor
I got to thinking more about this. How are the databases administered? In other words how are they started/stopped, upgraded, logs read, etc? Databases are working many years in 24x7 mode without administration. For every new new site newest PostgreSql was installed. Andrus. -- Sent via pg

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Tom Lane
"Andrus Moor" writes: >> No, this is just pilot error. Any version of pg_dump will produce >> output that is meant to be loaded into the matching server version >> (or a later version). If you are intending to load back into 8.4, >> use the 8.4 pg_dump. > Windows application needs to support ba

Re: [GENERAL] Is possible to use Prepare/Execute inside a function?

2010-12-15 Thread Alban Hertroys
On 15 Dec 2010, at 18:10, fel...@informidia.com.br wrote: > Hello, I'm having problems with a function after the postgres server has been > upgraded to 8.3.10 (I used 8.3.7). I did some testing and found some strange > situations. There shouldn't be any differences when upgrading between minor

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Adrian Klaver
On Wednesday 15 December 2010 8:43:18 am Andrus Moor wrote: > > Why does it have that requirement? And why doesn't it use the pg_dump > > that came with the server? It seems pretty lame to assume that your app > > has to provide pg_dump and not any other part of the Postgres > > installation. > >

Re: [GENERAL] Searing array fields - or should I redesign?

2010-12-15 Thread Jan Kesten
> eg, insert into logtable values ( 'vehicle123', now(), > {{'voltage','13'},{'rpm','600'}}; > > However, I am not sure how I can write a query - for example to read all > records where the voltage field is less than 13. Performance in this case is > not a real significant issue. > > Would I

[GENERAL] Searing array fields - or should I redesign?

2010-12-15 Thread Bryan Montgomery
Hello, I have a process that is logging data from vehicles. I'm looking for thoughts on the pros and cons of different approaches to storing this data - and retrieving it. Different vehicles report different types of data. The current process stores the data in a multi-dimensional array. eg, inser

Re: [GENERAL] Fast Insert and Update (through COPY)

2010-12-15 Thread Merlin Moncure
On Wed, Dec 15, 2010 at 10:17 AM, Yan Cheng CHEOK wrote: > Previously, I am inserting a bulk of data by using the following way. > > for each item >    update item into table >    if row count is 0 >        insert items into table > > I realize I am suffering performance problem. > > Later, I real

[GENERAL] Is possible to use Prepare/Execute inside a function?

2010-12-15 Thread fel...@informidia.com.br
Hello, I'm having problems with a function after the postgres server has been upgraded to 8.3.10 (I used 8.3.7). I did some testing and found some strange situations. -- not work with th

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Adrian Klaver
On 12/15/2010 08:43 AM, Andrus Moor wrote: Why does it have that requirement? And why doesn't it use the pg_dump that came with the server? It seems pretty lame to assume that your app has to provide pg_dump and not any other part of the Postgres installation. Application is like pg_admin. It i

Re: [GENERAL] Linux: PAE or x64

2010-12-15 Thread Magnus Hagander
On Wed, Dec 15, 2010 at 17:34, Scott Marlowe wrote: > On Wed, Dec 15, 2010 at 8:20 AM, Peter Geoghegan > wrote: >> Actually, there is a 64-bit port for windows now. I don't think I >> misrepresented Magnus - the post suggested that the then-lack of a >> 64-bit windows port wasn't a pressing issue

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Andrus Moor
Why does it have that requirement? And why doesn't it use the pg_dump that came with the server? It seems pretty lame to assume that your app has to provide pg_dump and not any other part of the Postgres installation. Application is like pg_admin. It is typical client application which is used

Re: [GENERAL] Linux: PAE or x64

2010-12-15 Thread Scott Marlowe
On Wed, Dec 15, 2010 at 8:20 AM, Peter Geoghegan wrote: > Actually, there is a 64-bit port for windows now. I don't think I > misrepresented Magnus - the post suggested that the then-lack of a > 64-bit windows port wasn't a pressing issue, and that various > technical considerations *partially* ju

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Adrian Klaver
On 12/15/2010 07:34 AM, Andrus Moor wrote: No, this is just pilot error. Any version of pg_dump will produce output that is meant to be loaded into the matching server version (or a later version). If you are intending to load back into 8.4, use the 8.4 pg_dump. You may have been reading the rec

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Andrus Moor
No, this is just pilot error. Any version of pg_dump will produce output that is meant to be loaded into the matching server version (or a later version). If you are intending to load back into 8.4, use the 8.4 pg_dump. You may have been reading the recommendation to use the later version's pg_

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Tom Lane
"Andrus Moor" writes: > I used only 9.0 dump and restore. I did the following: > 1. Created backup copy from 8.4.3 using 9.0 pg_dump > 2. Restored from this backup to 8.4.3 using 9.0 pg_restore > 9.0 pg_restore fails since 8.4.3 server reports invalid sql command in > create > language plpgsql

Re: [GENERAL] Linux: PAE or x64

2010-12-15 Thread Peter Geoghegan
On 15 December 2010 14:13, Stephen Frost wrote: > You're misreading poor Magnus.  He didn't offer any 'justification' > regarding why there isn't a Win64 port.  He simply was pointing out, for > those who assume every 'real' tool must be 64bit, that a 32bit PG is > still a very viable and useful t

[GENERAL] Fast Insert and Update (through COPY)

2010-12-15 Thread Yan Cheng CHEOK
Previously, I am inserting a bulk of data by using the following way. for each item update item into table if row count is 0 insert items into table I realize I am suffering performance problem. Later, I realize it is much fast by using COPY I am very happy with the speed. La

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Andrus Moor
Adrian, thank you. I am not sure I follow. Are you taking a pg_dump of a 9.0 database using a 9.0 version of pg_dump and trying to restore to a 8.4.3 database or are using the 9.0 pg_dump against the 8.4.3 server and then restoring back to it? In either case the problem you see above will proba

Re: [GENERAL] create language 'plpythonu' on win failed

2010-12-15 Thread Adrian Klaver
On Tuesday 14 December 2010 10:39:35 pm MICHÁLEK Jan Mgr. wrote: > I'm superuser. I have the same problem on both mz computers, on PC with win > xp and on ntb with win 7. Both postgresql is 9.0 and on both I have python > 27. Sorry I was not more explicit. Are the permissions on the directory/file

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Adrian Klaver
On Wednesday 15 December 2010 1:29:09 am Andrus Moor wrote: > Server is > > PostgreSQL 8.4.3 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real (Debian > 4.3.2-1.1) 4.3.2, 32-bit > > Backup is created using 9.0RC pg_dump.exe file > > Trying to restore from this backup to same server using 9.0RC >

Re: [GENERAL] Linux: PAE or x64

2010-12-15 Thread Stephen Frost
* Peter Geoghegan (peter.geoghega...@gmail.com) wrote: > And yet, that has been used by authoritative people as a partial > justification for pg lacking a 64-bit version on Windows in the past > on more than one occasion. You're misreading poor Magnus. He didn't offer any 'justification' regardin

Re: [GENERAL] Understanding Schema's

2010-12-15 Thread Jacqui Caren-home
On 15/12/2010 00:20, Carlos Mennens wrote: Why would anyone in a random scenario want to have independent schema's to cross query? I'm just trying to see how this would be useful in any scenario. One very real example :-) When migrating from say mysql to PgSQL it is possible to populate a "myg

Re: [GENERAL] Changing WAL Directory in Postgres

2010-12-15 Thread Filip Rembiałkowski
in short: sudo su - postgres pg_ctl stop -m fast cd $PGDATA mv pg_xlog /another/device ln -s /another/device/pg_xlog . pg_ctl start 2010/12/15 Adarsh Sharma > Hi all, > > From the last 2 days I am researching on Performance Tuning in Postgres. > > For this , I have to change my WAL directory t

Re: [GENERAL] Linux: PAE or x64

2010-12-15 Thread Peter Geoghegan
On 15 December 2010 10:37, Laurent Wandrebeck wrote: > Don't even bother with PAE. Let it rot. > memory consumption due to 64 bits pointers is negligible. And yet, that has been used by authoritative people as a partial justification for pg lacking a 64-bit version on Windows in the past on more

Re: [GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread tuanhoanganh
You can test restore by change CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql; to CREATE PROCEDURAL LANGUAGE plpgsql; Tuan Hoang Anh 2010/12/15 Andrus Moor > Server is > > PostgreSQL 8.4.3 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real (Debian > 4.3.2-1.1) 4.3.2, 32-bit > > Backup is created

Re: [GENERAL] [SQL] How to convert string to integer

2010-12-15 Thread Viktor Bojović
On Wed, Dec 15, 2010 at 11:23 AM, venkat wrote: > Dear All, > > How do i convert string to int > > select SUM(pan_1) from customers1 where name='101' > > When i run the above query i m getting "function sum(character varying) > does not exist".. > > Please anyone can guide me.. > > Thanks > >

Re: [GENERAL] Linux: PAE or x64

2010-12-15 Thread Laurent Wandrebeck
On Wed, 15 Dec 2010 11:30:14 +0100 Marcin Krol wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hello, > > I'll use PG on a dedicated machine with more than 4GB of memory. > > The problem is: what would be better to use: PAE ("bigmem" kernels) or > 64-bit kernel? > > PAE pro: half

[GENERAL] Linux: PAE or x64

2010-12-15 Thread Marcin Krol
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I'll use PG on a dedicated machine with more than 4GB of memory. The problem is: what would be better to use: PAE ("bigmem" kernels) or 64-bit kernel? PAE pro: half the memory per pointer, int, etc. PAE risk: is PG able to take advantage of

Re: [GENERAL] [SQL] How to convert string to integer

2010-12-15 Thread Pavel Stehule
Hello you can use a ::int for converting to integer. Or better - you can alter column to integer. It will be faster and more correct. Regards Pavel Stehule 2010/12/15 venkat : > Dear All, >   How do i convert string to int > select SUM(pan_1) from customers1 where name='101' > When i run the ab

Re: [GENERAL] How to convert string to integer

2010-12-15 Thread Szymon Guz
On 15 December 2010 11:23, venkat wrote: > Dear All, > > How do i convert string to int > > select SUM(pan_1) from customers1 where name='101' > > When i run the above query i m getting "function sum(character varying) > does not exist".. > > Please anyone can guide me.. > > Thanks > > > selec

[GENERAL] How to convert string to integer

2010-12-15 Thread venkat
Dear All, How do i convert string to int select SUM(pan_1) from customers1 where name='101' When i run the above query i m getting "function sum(character varying) does not exist".. Please anyone can guide me.. Thanks

Re: [GENERAL] C++ code - PGRES_TUPLES_OK is not returned when DELETE performed

2010-12-15 Thread Dmitriy Igrishin
Hey Yan Cheng, The status of command is PGRES_COMMAND_OK only when performed command was not returns data, e.g. DELETE (without RETURNING clause), BEGIN, COMMIT etc. The status PGRES_TUPLES_OK only when performed command was SELECT, SHOW or UPDATE / DELETE with RETURNING clause and etc. 2010/12/1

[GENERAL] How to restore from backup to 8.4.3 server using 9.0 dump/restore

2010-12-15 Thread Andrus Moor
Server is PostgreSQL 8.4.3 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real (Debian 4.3.2-1.1) 4.3.2, 32-bit Backup is created using 9.0RC pg_dump.exe file Trying to restore from this backup to same server using 9.0RC pg_restore.exe causes error "..\pg_dump\pg_restore.exe" -h mysite.com -U

[GENERAL] C++ code - PGRES_TUPLES_OK is not returned when DELETE performed

2010-12-15 Thread Yan Cheng CHEOK
I realize for the following code : PGconn *connection = this->connection.getConnection(); PGresult *res = PQexec(connection, "DELETE FROM measurement_statistic WHERE fk_lot_id = 47"); // status always false?? const bool status = (PQresultStatus(res) == PGRES_TUPLES_OK); status will always rema