Re: [GENERAL] 110,000,000 rows

2010-05-27 Thread John Gage
Herbert Simon must be spinning in his grave...or smiling wisely. What does a human do with a petabyte of data? But when a desktop machine for $1700 retail has a terabyte of storage, the unix operating system, 4 gigs of memory, and an amazing 27 inch display, I guess hardware isn't the

Re: [GENERAL] 110,000,000 rows

2010-05-27 Thread Massa, Harald Armin
Dann, There really are domains that big, so that there is no more normalization or other processes to mitigate the problem. Examples: Microsoft's registered customers database (all MS products bought by any customer, including operating systems) Tolls taken on the New Jersey road system for

[GENERAL] XML index

2010-05-27 Thread Chris Roffler
I have a table with an xml column, created an index as follows: *CREATE INDEX xml_index* * ON test* * USING btree* * (((xpath('//*/ChangedBy/text()'::text, external_attributes))[1]::text));* And here is my select statement: *Select uuid from t * * where (xpath('//*/ChangedBy/text()',

Re: [GENERAL] XML index

2010-05-27 Thread Thom Brown
On 27 May 2010 12:22, Chris Roffler croff...@earthlink.net wrote: I have a table with an xml column, created an index as follows: CREATE INDEX xml_index   ON test   USING btree   (((xpath('//*/ChangedBy/text()'::text, external_attributes))[1]::text)); And here is my select statement: Select

Re: re[GENERAL] ducing postgresql disk space

2010-05-27 Thread paladine
command output for mentioned db : ' my_db_name | 42 GB ' I don't print query results to logfile. I restore my system logs to db. I have a lot of live ( growing ) logs on my machine and I register these logs to db. My essential question is that why don't I reclaim disk space though I run this

Re: re[GENERAL] ducing postgresql disk space

2010-05-27 Thread paladine
Firstly, thanks for your explanations... Are you attempting a one-time space reduction or are you having general bloat issues? Unfortunately, I have growing bloat issues so I want to reduce space as it filled up. Thus I wrote a script but as I said before it doesn't reclaim disk space.

Re: re[GENERAL] ducing postgresql disk space

2010-05-27 Thread paladine
alter a table column to its own type, like this: alter table foo alter column my_counter type integer; -- my_counter is already an integer Is that really reclaim disk space and how ?? For example; if 'my_counter' column is already integer, why do I alter this column to integer again ?

[GENERAL] Download

2010-05-27 Thread Faiyaz Allie
Hi There I would like to find out where I can download Postgresql 8.1.7 rpm for Redhat 5.5. I'm trying to load an application that requires it. I've tried to download it from your site but the link times out. Any help will be appreciated. Regards Faiyaz Allie Operations Manager

Re: [GENERAL] XML index

2010-05-27 Thread Chris Roffler
Tried that same thing On Thu, May 27, 2010 at 1:53 PM, Thom Brown thombr...@gmail.com wrote: On 27 May 2010 12:22, Chris Roffler croff...@earthlink.net wrote: I have a table with an xml column, created an index as follows: CREATE INDEX xml_index ON test USING btree

Re: [GENERAL] 110,000,000 rows

2010-05-27 Thread Nikolas Everett
I've had a reporting database with just about a billion rows. Each row was horribly large because the legacy schema had problems. We partitioned it out by month and it ran about 30 million rows a month. With a reasonably large box you can get that kind of data into memory and indexes are almost

Re: [GENERAL] 110,000,000 rows

2010-05-27 Thread Thom Brown
On 27 May 2010 14:48, Nikolas Everett nik9...@gmail.com wrote: I've had a reporting database with just about a billion rows.  Each row was horribly large because the legacy schema had problems.  We partitioned it out by month and it ran about 30 million rows a month.  With a reasonably large

[GENERAL] Please help me write a query

2010-05-27 Thread Nikolas Everett
Say I have a table that stores state transitions over time like so: id, transitionable_id, state1, state2, timestamp I'm trying to write a query that coalesces changes in state2 away to produce just a list of transitions of state1. I guess it would look something like SELECT state1,

Re: [GENERAL] Please help me write a query

2010-05-27 Thread Ozz Nixon
Lost me a bit, do you mean DISTINCT? select distinct state1, first(timestamp) from table On May 27, 2010, at 10:04 AM, Nikolas Everett wrote: Say I have a table that stores state transitions over time like so: id, transitionable_id, state1, state2, timestamp I'm trying to write a query

[GENERAL] hi, trying to compile postgres 8.3.11

2010-05-27 Thread erobles
hi, i tried to compile postgres 8.3.11 on SCO OpenServer 5.0.7, but ... when the xlog.o is being compiled i have the next error: /usr/tmp/ccihgiYL.s: 1113: syntax error at name f /usr/tmp/ccihgiYL.s: 1113: syntax error at integer constant: 1 i dont have copy of that assembly file because

Re: [GENERAL] Please help me write a query

2010-05-27 Thread Nikolas Everett
Sorry. Here is the setup: CREATE TABLE test (id BIGSERIAL PRIMARY KEY, state1 INT NOT NULL, state2 INT NOT NULL, timestamp TIMESTAMP); INSERT INTO test (state1, state2, timestamp) VALUES (1, 1, now() - interval '12 hours'); INSERT INTO test (state1, state2, timestamp) VALUES (1, 2, now() -

Re: [GENERAL] hi, trying to compile postgres 8.3.11

2010-05-27 Thread Merlin Moncure
On Thu, May 27, 2010 at 10:42 AM, erobles erob...@sensacd.com.mx wrote: hi, i tried to compile postgres 8.3.11 on SCO OpenServer 5.0.7, but ... when the xlog.o is being compiled  i have the next error: /usr/tmp/ccihgiYL.s: 1113: syntax error at name f /usr/tmp/ccihgiYL.s: 1113: syntax error

Re: [GENERAL] Statement Pooling

2010-05-27 Thread Joshua Tolley
On Tue, May 25, 2010 at 05:28:10PM +0200, Janning wrote: Our hibernate stack uses prepared statements. Postgresql is caching the execution plan. Next time the same statement is used, postgresql reuses the execution plan. This saves time planning statements inside DB. It only uses the cached

Re: [GENERAL] XML index

2010-05-27 Thread Chris Roffler
Changed the create index statement to : USING hash and it seems to work. Any idea why btree does not work ? Thanks Chris On Thu, May 27, 2010 at 3:47 PM, Chris Roffler croff...@earthlink.netwrote: Tried that same thing On Thu, May 27, 2010 at 1:53 PM, Thom Brown thombr...@gmail.com

Re: [GENERAL] hi, trying to compile postgres 8.3.11

2010-05-27 Thread Tom Lane
erobles erob...@sensacd.com.mx writes: i tried to compile postgres 8.3.11 on SCO OpenServer 5.0.7, but ... when the xlog.o is being compiled i have the next error: /usr/tmp/ccihgiYL.s: 1113: syntax error at name f /usr/tmp/ccihgiYL.s: 1113: syntax error at integer constant: 1 Looks like

Re: [GENERAL] hi, trying to compile postgres 8.3.11

2010-05-27 Thread erobles
i have been using gcc 2.95.2 to compile On 05/27/2010 10:02 AM, Tom Lane wrote: erobleserob...@sensacd.com.mx writes: i tried to compile postgres 8.3.11 on SCO OpenServer 5.0.7, but ... when the xlog.o is being compiled i have the next error: /usr/tmp/ccihgiYL.s:

Re: [GENERAL] Please help me write a query

2010-05-27 Thread Justin Graf
On 5/27/2010 9:04 AM, Nikolas Everett wrote: Say I have a table that stores state transitions over time like so: id, transitionable_id, state1, state2, timestamp I'm trying to write a query that coalesces changes in state2 away to produce just a list of transitions of state1. I guess it

Re: [GENERAL] hi, trying to compile postgres 8.3.11

2010-05-27 Thread Tom Lane
erobles erob...@sensacd.com.mx writes: i have been using gcc 2.95.2 to compile At least get onto 2.95.3 ;-). I've been using that version on HPPA for quite awhile and haven't tripped across any bugs. But in any case these are stone-age versions. regards, tom

Re: [GENERAL] Download

2010-05-27 Thread Craig Ringer
On 27/05/2010 4:44 PM, Faiyaz Allie wrote: Hi There I would like to find out where I can download Postgresql 8.1.7 rpm for Redhat 5.5. I’m trying to load an application that requires it. I’ve tried to download it from your site but the link times out. What download link are you using? Which

Re: [GENERAL] hi, trying to compile postgres 8.3.11

2010-05-27 Thread Craig Ringer
On 27/05/2010 10:42 PM, erobles wrote: hi, i tried to compile postgres 8.3.11 on SCO OpenServer 5.0.7 Possibly stupid question: Why? Do you need the Pg server to run on SCO OpenServer? Or just a client? Have you considered running your (presumably SCO-based) client with a network connection

Re: [GENERAL] Please help me write a query

2010-05-27 Thread Justin Graf
On 5/27/2010 9:45 AM, Nikolas Everett wrote: Sorry. Here is the setup: CREATE TABLE test (id BIGSERIAL PRIMARY KEY, state1 INT NOT NULL, state2 INT NOT NULL, timestamp TIMESTAMP); INSERT INTO test (state1, state2, timestamp) VALUES (1, 1, now() - interval '12 hours'); INSERT INTO test

Re: [GENERAL] Please help me write a query

2010-05-27 Thread Nikolas Everett
The 10 and 11 hour interval are being skipped because I'm only interested in the transitions of state 1. State 1 only transitioned three times at now - 12, now - 9 and now - 8. The table has both transitions in it because I frequently care about them both together. I just don't in this case. On

Re: [GENERAL] Please help me write a query

2010-05-27 Thread Nikolas Everett
Got it: SELECT state1, timestamp FROM (SELECT state1, timestamp, lag(state1) OVER (ORDER BY timestamp) FROM test) as foo WHERE state1 != lag OR lag IS NULL ORDER BY timestamp; state1 | timestamp + 1 | now() - interval '12 hours'

Re: [GENERAL] hi, trying to compile postgres 8.3.11

2010-05-27 Thread erobles
On 05/27/2010 10:29 AM, Craig Ringer wrote: On 27/05/2010 10:42 PM, erobles wrote: hi, i tried to compile postgres 8.3.11 on SCO OpenServer 5.0.7 Possibly stupid question: Why? Do you need the Pg server to run on SCO OpenServer? Yes, i need it :-P Before i have running pg 7.2 after we

Re: [GENERAL] Please help me write a query

2010-05-27 Thread Tim Landscheidt
Nikolas Everett nik9...@gmail.com wrote: Sorry. Here is the setup: CREATE TABLE test (id BIGSERIAL PRIMARY KEY, state1 INT NOT NULL, state2 INT NOT NULL, timestamp TIMESTAMP); INSERT INTO test (state1, state2, timestamp) VALUES (1, 1, now() - interval '12 hours'); INSERT INTO test (state1,

[GENERAL] UPDATE...RETURNING col INTO var - what is returned?

2010-05-27 Thread Rainer Pruy
Hi all, I just got quite confused on the exact semantics of RETURNING expressions INTO target with an update statement. And while trying to resolve failed to find an answer in the docs. Question was whether - in case expression is involving a column that is assigned by the update itself - the

Re: [GENERAL] UPDATE...RETURNING col INTO var - what is returned?

2010-05-27 Thread Alban Hertroys
On 27 May 2010, at 18:12, Rainer Pruy wrote: Hi all, I just got quite confused on the exact semantics of RETURNING expressions INTO target with an update statement. And while trying to resolve failed to find an answer in the docs. Question was whether - in case expression is involving a

Re: [GENERAL] 110,000,000 rows

2010-05-27 Thread Torsten Zühlsdorff
John Gage schrieb: Please forgive this intrusion, and please ignore it, but how many applications out there have 110,000,000 row tables? I recently multiplied 85,000 by 1,400 and said now way Jose. I have two private applications with about 250,000,000 rows a table. I could cluster them,

[GENERAL] Auto vacuum configuration in postgres.

2010-05-27 Thread venu madhav
Hi All, In my application we are using postgres which runs on an embedded box. I have configured autovacuum to run once for every one hour. It has 5 different databases in it. When I saw the log messages, I found that it is running autovacuum on one database every hour. As a result, on my

[GENERAL] conditional rules VS 1 unconditional rule with multiple commands?

2010-05-27 Thread Davor J.
I just wonder whether the two are equivalent from user perspective: As far as I see, you can always rewrite a multi-command rule as a conditional rule and vice versa. Further more, Postgres seems to execute all the conditional rules, just as if it would execute all the commands in the one

Re: [GENERAL] 110,000,000 rows

2010-05-27 Thread Torsten Zühlsdorff
John Gage schrieb: Herbert Simon must be spinning in his grave...or smiling wisely. What does a human do with a petabyte of data? for example i have a private search-engine for my most often used sites. google and the other ones always know just a part of the whole site, my own one knowns

[GENERAL] EXECUTE and FOUND

2010-05-27 Thread Bogdan Gusiev
I am not sure if EXECUTE 'SELECT * FROM table correctly sets FOUND variable. EXECUTE 'SELECT * FROM ' || quote_ident(stmt.tablename) || ' limit 1'; if found then end if; Is there other way to check if EXECUTE 'SELECT ...' found something or not? -- Sent via pgsql-general mailing list

Re: [GENERAL] UPDATE ... RETURNING atomicity

2010-05-27 Thread Lew
On 05/23/2010 02:15 AM, rihad wrote: In this query: UPDATE foo SET allocated_to=? WHERE id=(SELECT MIN(id) FROM foo WHERE allocated_to IS NULL) AND allocated_to IS NULL RETURNING id Isn't the AND allocated_to IS NULL clause redundant? -- Lew -- Sent via pgsql-general mailing list

[GENERAL] No lidbl.so in libpq.so (postgresql 8.4.4)

2010-05-27 Thread Gary Fu
Hi, On my mandriva linux, I don't have problem to build pgpool 2.3.3 with postgresql 8.4.2. But when I upgraded to 8.4.4, I cannot build pgpool again due to the libdl.so is not required in libpq.so (from the ldd command). Do you know how to build the 8.4.4 so that libdl.so is required in

Re: [GENERAL] EXECUTE and FOUND

2010-05-27 Thread Pavel Stehule
2010/5/25 Bogdan Gusiev agre...@gmail.com: I am not sure if EXECUTE 'SELECT * FROM table correctly sets FOUND variable. no - it doesn't it EXECUTE 'SELECT * FROM ' || quote_ident(stmt.tablename) || ' limit 1'; if found then   end if; Is there other way to check if EXECUTE 'SELECT

Re: [GENERAL] Download

2010-05-27 Thread Devrim GÜNDÜZ
On Thu, 2010-05-27 at 10:44 +0200, Faiyaz Allie wrote: I would like to find out where I can download Postgresql 8.1.7 rpm for Redhat 5.5. I'm trying to load an application that requires it I'm not sure that you will be able to find 8.1.7 around. 8.1.21 is the latest on 8.1, and I think your

Re: [GENERAL] conditional rules VS 1 unconditional rule with multiple commands?

2010-05-27 Thread Alban Hertroys
On 27 May 2010, at 12:36, Davor J. wrote: I just wonder whether the two are equivalent from user perspective: As far as I see, you can always rewrite a multi-command rule as a conditional rule and vice versa. Further more, Postgres seems to execute all the conditional rules, just as if it

[GENERAL] Enforcing unique column with triggers and hash

2010-05-27 Thread Data Growth Pty Ltd
I have a large table (200 million rows) with a column ( 'url' character varying(255)) that I need to be unique. Currently I do this via a UNIQUE btree index on (lower(url::text)) The index is huge, and I would like to make it much smaller. Accesses to the table via this key are a tiny portion

Re: [GENERAL] No lidbl.so in libpq.so (postgresql 8.4.4)

2010-05-27 Thread Nilesh Govindarajan
On Tue, May 25, 2010 at 7:48 PM, Gary Fu gary...@sigmaspace.com wrote: Hi, On my mandriva linux, I don't have problem to build pgpool 2.3.3 with postgresql 8.4.2.  But when I upgraded to 8.4.4, I cannot build pgpool again due to the libdl.so is not required in libpq.so (from the ldd command).

Re: [GENERAL] Auto vacuum configuration in postgres.

2010-05-27 Thread Nilesh Govindarajan
On Mon, May 24, 2010 at 6:23 PM, venu madhav venutaurus...@gmail.com wrote: Hi All,       In my application we are using postgres which runs on an embedded box. I have configured autovacuum to run once for every one hour. It has 5 different databases in it. When I saw the log messages, I

Re: [GENERAL] recovery after interrupt in the middle of a previous recovery

2010-05-27 Thread Or Kroyzer
Thanks. 2010/5/26 Tom Lane t...@sss.pgh.pa.us Or Kroyzer orkroy...@gmail.com writes: I am using postgres 8.3.1, ... you really ought to be using 8.3.something-recent ... and have implemented warm standby very much like the one described in the high availability documentation on this