db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendleton.de...@gmail.com>
Subject Re: slow query? (from a practical newbie)
Date Tue, 07 Jan 2014 01:03:09 GMT
> select a.* from (select * from ducc.job order by stateIndex asc, id
> desc) a where id < 117000

Why is this query written like this, as opposed to, say:

   select * from ducc.job order by stateIndex asc, id desc
          where id < 117000

Do you get a different query plan / run time if you use a
single top-level query and eliminate the sub-query?

I think the optimizer does a pretty good job in general of
optimizing sub queries but maybe the presence of the ORDER BY
in the sub query is making it hard for the query optimizer
to perform the query efficiently?

thanks,

bryan


Mime
View raw message