[SQL] join on three tables is slow

2007-12-09 Thread Gerry Reno
I have a join that uses three tables but it runs rather slow. For example, the following command takes about 10 min. to run. It gets the correct result but what should I do to increase the performance of this query? This query is the end result of some python code hence the big id list. my

Re: [SQL] join on three tables is slow

2007-12-09 Thread Gerry Reno
Here is the query plan: QUERYPLAN

Re: [SQL] join on three tables is slow

2007-12-09 Thread Shane Ambler
Gerry Reno wrote: I have a join that uses three tables but it runs rather slow. For example, the following command takes about 10 min. to run. It gets the correct result but what should I do to increase the performance of this query? This query is the end result of some python code hence the

[SQL] SQL INSERT/TRIGGER Help

2007-12-09 Thread Poovendran Moodley
Hi all, I'm not sure how to phrase this question... I have a table that requires a foreign key of another table - this foreign key is automatically generated and the key field in the 'foreign' table. So I have the following situation (kind of): Table *Observation* *Time_Stamp* - *primary key* ..

Re: [SQL] SQL INSERT/TRIGGER Help

2007-12-09 Thread A. Kretschmer
am Mon, dem 10.12.2007, um 8:36:44 +0200 mailte Poovendran Moodley folgendes: > So obviously I need to insert into the table Observation_Value first before I > can insert into table Observation, but how to I get the automatically > generated > foreign key? You can simple use currval() for this.

Re: [SQL] SQL INSERT/TRIGGER Help

2007-12-09 Thread Poovendran Moodley
I'm not really sure how to the *currval() *method. I've read up on it and I noticed it works with *nextval()* and *setval()*. The parameter for * currval()* is a regex - is there a regex to represent the most recently automatically generated number ( i.e. a serial field)? If there isn't, I was thin

Re: [SQL] SQL INSERT/TRIGGER Help

2007-12-09 Thread A. Kretschmer
am Mon, dem 10.12.2007, um 9:27:58 +0200 mailte Poovendran Moodley folgendes: > I'm not really sure how to the currval() method. I've read up on it and I > noticed it works with nextval() and setval(). The parameter for currval() is a > regex - is there a regex to represent the most recently auto