Re: Sub-selects taking way too long.. - Mailing list pgsql-general

From Alexis Maldonado
Subject Re: Sub-selects taking way too long..
Date
Msg-id 007701c1e00a$d5217900$14818b0a@ctcd.cc.tx.us
Whole thread Raw
In response to Re: Sub-selects taking way too long..  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
thanks i'll try that :)

----- Original Message -----
From: "Stephan Szabo" <sszabo@megazone23.bigpanda.com>
To: "Alexis Maldonado" <amaldona@ctcd.cc.tx.us>
Cc: <pgsql-general@postgresql.org>
Sent: Tuesday, April 09, 2002 3:56 PM
Subject: Re: [GENERAL] Sub-selects taking way too long..


> On Tue, 9 Apr 2002, Alexis Maldonado wrote:
>
> > Ok.. I know its provably something im doing dumb..
> > but here it goes..
> >
> > I have 2 tables that are the same:
> >
> > "temp_table" and "table"
> >
> > "temp _table" has 7,761 rows and "table" is empty
> >
> > the columns for both tables are: ID (primary key sequence), index,
column1,
> > column2
> >
> > when i run:
> >
> > Insert Into table
> > select index, column1, column2
> > from temp_table
> > where index NOT IN (select index from table)
>
> IN is unfortunately implemented slowly (I think the FAQ answer has more
> details)
>
> You can often get better performance using exists, I think the equivalent
> would be:
> insert into table
> select index, column1, column2 from temp_table
> where NOT EXISTS (select * from table where table.index=temp_Table.index)
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


pgsql-general by date:

Previous
From: Justin Clift
Date:
Subject: More UB-Tree patent information
Next
From: "Alexis Maldonado"
Date:
Subject: Re: Sub-selects taking way too long..