Subject Re: [firebird-support] How can I do INTERSECTS clause on IB/FB
Author Helen Borrie
At 11:11 AM 16/06/2003 +0900, you wrote:
>Hi
>
>I have a question about INTERSECTS clause.
>
>Using Oracle:
>
>SELECT * FROM ATBL
>INTERSECTS
>SELECT * FROM BTBL
>
>Using IB/FB:
>SELECT * FROM ATBL
>WHERE EXISTS(
>SELECT * FROM BTBL
>WHERE ATBL.A=BTBL.A
>AND ATBL.B=BTBL.B
> .
> .
> .
>);
>
>It is bery long. What is the better way?

In principle, for a direct query, this should be the best way. A stored
procedure would probably be faster but, if this query is slow because of
unsuitable indexes, then a stored procedure would be slowed down by that as
well.

What are the numbers involved? (How many rows? are the rows very
wide? How long does it take?)

What indexes are available?

I see dots in your sample code - what else is in this query? Do you have
an ORDER BY clause? If so, are there indexes on the ordering columns?

Can you show the plan that the query uses?

Helen