Subject Re: Query slow
Author sivram_mail
Hi Martijn,

sorry for reposting..


this is my query:
-----------------

Hello,
i have two tables .

table 1

id name no

table 2

id no

table 2's id field is referenced to table 1's id field .


now i want to retrieve the records from table 1 and no not in
table 2.

this is the query which is written:
-----------------------------------
select * from table1 where id not in
(select id from table2,table1 where table1.no=table2.no )

In this query , there is no join condition for primary key.


If i rearrange this query to

select * from table1 a where
a.id not in (select id from
table2 b where a.id=b.id and a.no=b.no)


Will it work fine????
And my dba is telling that don't use "ot in".
without "not in" how can i write this query??


Thanks in advance

Sivaraman











--- In ib-support@yahoogroups.com, "Martijn Tonies" <m.tonies@u...>
wrote:
>
>
>
> > First table is containing 40,000 records and second table contains
> > some 10,000 records.



> >
> > Why is it very slow?We checked the indexing also.My dba told it
is
> > perfect.
> >
> > Need a solution soon
>
> For what? What is slow?
>
>
> With regards,
>
> Martijn Tonies
> Database Workbench - the developer tool for InterBase & Firebird
> Upscene Productions
> http://www.upscene.com
>
> See you at the First European Firebird Conference in May in Fulda,
Germany
> http://www.firebird-conference.com