Subject RE: [firebird-support] What the best way to to join 2 tables across 2 databases ?
Author Svein Erling Tysvær
>hello,
>
>What the best way to join 2 tables across 2 databases ?
>
>actually i do on the 1st database a select First 100 ID from myTable1 where ...
>and in the second database select * from MyTable2 where ID in
>(<id_we_retrieve_from_the_first_select>)
>
>but the problem, the select * from MyTable2 where ID in
>(<id_we_retrieve_from_the_first_select>) is very slow, especially on the prepare
>
>is there any better way ?

Please specify 'very slow', I'd expect your query to be about as quick as you can get it. If I remember correctly, you've been discussing transaction and statement pooling on this list recently. In your statement above, are you using 100 parameters and statement pooling or creating the <id_we_retrieve_from_the_first_select> on the fly? I don't know which of these would be most efficient, both could be worth trying. Another option to consider (it might be slower) is to use a stored procedure with the IDs as one input parameter and then parse things within the stored procedure.

Set