Post the query and table and index DDL.

On Mon, Oct 27, 2008 at 23:10, Amir Michail <amichail@gmail.com> wrote:
On Mon, Oct 27, 2008 at 6:07 PM, Peter Ondruška
> Well, in that case database engine has to read all relevant rows, then sort
> and only after that it can display the first row(s).

Why doesn't it use the index on the column specified in order by?

Amir

>
> On Mon, Oct 27, 2008 at 23:02, Amir Michail <amichail@gmail.com> wrote:
>>
>> On Mon, Oct 27, 2008 at 5:59 PM, Peter Ondruška
>> <peter.ondruska@gmail.com> wrote:
>> > Please, post the query you are running.
>> > There are queries where setMaxRows will not be faster, for example if
>> > you do
>> > GROUP BY or ORDER BY.
>>
>> The order is important, so I'm using order by.
>>
>> Amir
>>
>> >
>> > On Mon, Oct 27, 2008 at 22:51, Amir Michail <amichail@gmail.com> wrote:
>> >>
>> >> On Mon, Oct 27, 2008 at 5:45 PM, Daniel Noll <daniel@nuix.com> wrote:
>> >> > Amir Michail wrote:
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> What is a good way for efficiently getting the first k rows from a
>> >> >> query that also satisfy some additional condition to be determined
>> >> >> using Java code?
>> >> >
>> >> > setMaxRows(int) is the standard way of doing this in JDBC, it only
>> >> > falls
>> >> > over if you later want to retrieve rows k..(2k-1).
>> >> >
>> >> > Daniel
>> >> >
>> >>
>> >> It's slow with setMaxRows.
>> >>
>> >> Amir
>> >>
>> >> >
>> >> > --
>> >> > Daniel Noll                            Forensic and eDiscovery
>> >> > Software
>> >> > Senior Developer                              The world's most
>> >> > advanced
>> >> > Nuix                                                email data
>> >> > analysis
>> >> > http://nuix.com/                                and eDiscovery
>> >> > software
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> http://chatbotgame.com
>> >> http://numbrosia.com
>> >> http://twitter.com/amichail
>> >
>> >
>>
>>
>>
>> --
>> http://chatbotgame.com
>> http://numbrosia.com
>> http://twitter.com/amichail
>
>



--