Bryan Pendleton wrote:

> Harshad wrote:
>>   "select name,version,release,time from PKG where PKG.id in (select id
>>   from PROVIDES where name = ?)",
> 
> What happens if you run this statement instead:
> 
> select pkg.name,pkg.version,pkg.release,pkg.time from pkg, provides
>         where pkg.id = provides.id and provides.name = ?


Whew! That solves it! No need for numbers, they are sub milli-second now!

Can't the SQL optimiser do this automatically? Is this a derby specific 
problem?  (Sorry for amateurish questions; this is my first real db application)

I ask because I have another application where I programmatically generate 
queries, and the former type of query is easier to generate than the one you 
suggested. I always assumed that the SQL optimiser will "flatten" the query...

Thanks,
Harshad

Reply via email to