Re: [SQL] Install two different versions of postgres which should run in parallel

2007-08-13 Thread Loredana Curugiu
I didn't succeed installing the two versions of postgres. For installing I am running the configure script as follows: ./configure --prefix=/usr/local/pgsql-7.4.5 --with-java --with-pgport=6947 Although I specify a different port than the default one, the postgres it is installed with the

Re: [SQL] Install two different versions of postgres which should run in parallel

2007-08-13 Thread Gerardo Herzig
Check the postgresql.conf in the $prefix/data dir. Also post the exact error log (which in this case should be some like address already in use, because port 5432 is in use by the 8.2.4 version), and also the exact command you are executing. Cheers. Gerardo I didn't succeed installing the

Re: [SQL] [NOVICE] Install two different versions of postgres which should run in parallel

2007-08-13 Thread Tom Lane
Loredana Curugiu [EMAIL PROTECTED] writes: For installing I am running the configure script as follows: ./configure --prefix=/usr/local/pgsql-7.4.5 --with-java --with-pgport=6947 Although I specify a different port than the default one, the postgres it is installed with the default port.

[SQL] Comparing two slices within one table efficiently

2007-08-13 Thread Ken Simpson
I have a table with the following simplified form: create table t ( run_id integer, domain_id integer, mta_id integer, attribute1 integer, attribute2 integer, unique(run_id, domain_id, mta_id) ); The table has about 1 million rows with run_id=1, another 1 million rows with run_id=2, and

Re: [SQL] Comparing two slices within one table efficiently

2007-08-13 Thread chester c young
I have a table with the following simplified form: create table t ( run_id integer, domain_id integer, mta_id integer, attribute1 integer, attribute2 integer, unique(run_id, domain_id, mta_id) ); The table has about 1 million rows with run_id=1, another 1 million rows with

Re: [SQL] Comparing two slices within one table efficiently

2007-08-13 Thread Andrew Kroeger
Ken Simpson wrote: I have a table with the following simplified form: create table t ( run_id integer, domain_id integer, mta_id integer, attribute1 integer, attribute2 integer, unique(run_id, domain_id, mta_id) ); The table has about 1 million rows with run_id=1, another 1

[SQL] how to moce back in refcursor

2007-08-13 Thread Christian Kindler
Hi I have never worked with cursors but for now I have to step back on special events to calculate a difference. So I have this sample code tested but I can not move in my cursor. I have lokke at docs but this didn't help me. Can you say how to declare my cursor to step back? Thank You Chris

Re: [SQL] Comparing two slices within one table efficiently

2007-08-13 Thread Christian Kindler
Yes and you could make it even more speedy with the use table partitioning. http://www.postgresql.org/docs/8.1/interactive/ddl-partitioning.html select t1.domain_id as domain_id, t1.mta_id as mta_id, t1.run_id as run_id_1, t1.attribute1 as attribute1_1, t1.attribute2 as

Re: [SQL] Comparing two slices within one table efficiently

2007-08-13 Thread Tom Lane
=?utf-8?B?S2VuIFNpbXBzb24=?= [EMAIL PROTECTED] writes: select * from t t1 where exists (select 1 from t t2 where t2.mta_id=t1.mta_id and t2.domain_id=t1.domain_id and (t2.attribute1 != t1.attribute1 or t2.attribute2 != t1.attribute2) This query takes millenia... Yeah, because you're

Re: [SQL] how to moce back in refcursor

2007-08-13 Thread Tom Lane
Christian Kindler [EMAIL PROTECTED] writes: -- move -1 in cur1; plpgsql supports that in CVS HEAD (8.3-to-be) but not in any existing release. You'll need to rethink your logic or do this from your application rather than within plpgsql. regards, tom lane

[SQL] Getting pk of the most recent row, in a group by

2007-08-13 Thread Bryce Nesbitt
I've got a table of coupons which have an expiration date. For each type of coupon, I'd like to get the primary key of the coupon which will expire first. # create table coupon ( coupon_id serial primary key, type varchar(255), expires date ); insert into coupon

Re: [SQL] Comparing two slices within one table efficiently

2007-08-13 Thread Ken Simpson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Christian Kindler [13/08/07 21:34 +0200]: Yes and you could make it even more speedy with the use table partitioning. http://www.postgresql.org/docs/8.1/interactive/ddl-partitioning.html Thanks for all your speedy help, everyone. I tried doing a

Re: [SQL] Getting pk of the most recent row, in a group by

2007-08-13 Thread Rodrigo De León
On 8/13/07, Bryce Nesbitt [EMAIL PROTECTED] wrote: In the second example, is it possible to get the primary key of the row with the minimum expires time? SELECT TYPE, MIN(expires), COUNT(*) , (SELECT MIN(coupon_id) FROM coupon WHERE expires = MIN(c.expires)) AS

Re: [SQL] [PERFORM] Performance on writable views

2007-08-13 Thread Jim Nasby
On Aug 11, 2007, at 8:58 AM, Joshua D. Drake wrote: Heikki Linnakangas wrote: Enrico Weigelt wrote: I'm often using writable views as interfaces to clients, so they only see virtual objects and never have to cope with the actual storage, ie. to give some client an totally denormalized view of

Re: [SQL] Getting pk of the most recent row, in a group by

2007-08-13 Thread Terry Fielder
Do you have a table of coupon types? Terry Terry Fielder [EMAIL PROTECTED] Associate Director Software Development and Deployment Great Gulf Homes / Ashton Woods Homes Fax: (416) 441-9085 Bryce Nesbitt wrote: I've got a table of coupons which have an expiration date. For each type of