Subject | Re: sort table depending on the select list instead of depending on the order-by |
---|---|
Author | woodsmailbox |
Post date | 2009-03-03T14:38:31Z |
> I tried to answer you're question which was, if I understandcorrectly,
> why doesn't firebird retrieve only the sort keys on the first pass,Well, surely it isn't the case in practice, since it makes a file on
> then sort them, then go back and retrieve all the other items in
> the select list. It doesn't because generally, I/O to the database
> is the most expensive operation it does, and doing it twice, once
> in storage order and once in random order relative to storage is
> likely to be slower than retrieving all the rows in the first pass.
the same expensive-I/O disk that is 26x than the whole database. The
result is a 40 seconds query that eats up 100% CPU while performing,
while a semantically equivalent query that joins _after_ the sort,
takes 3-4 seconds.
So the question is, how should I interpret this? bug, limitation?
And how can I reliably convince firebird that it should perform the
actions in the right order?