Re: *** SQL Problem, please help ***
Posted in 1997
Belakimem wrote:
>
> The second of the folowing SQL's takes forever.
>
> select distinct a from b where x = y into temp temp_table;>
> { this retrieves 3 rows }
>
> insert into c select * from db1@unixbox1:d where> a in ( select a from temp_table );
>
> If I change the "select a from temp_table" for an
> explicit "(value1,value2,value3)", then it is very fast.
>
> Obviously I cannot do this as I do not know what the values are going to
> be !
But, could you do something like this?
Instead of selecting into a temp table, build a string consisting of
what would be in the temp table, and prepare the insert statement?
>
> The problem is clearly related to the fact that the temp table resides on
> the "local" Unix box.
>
> Any thoughts / ideas on how to speed this up?
>
> Potential responders, please reply to my email address as well as the
> Newsgroup. Thank You.