Subject | Re: [firebird-support] Re: How to mix ascending and descending fields in one index |
---|---|
Author | Martijn Tonies |
Post date | 2009-10-09T08:03:22Z |
Hello Geoff,
"direct", so to speak, but I also said several times such an index
cannot be created while the OP continues to ask if it can be created.
In order to find a workaround, I asked why there should be a
resultset of millions of rows, to which the reply, I think, has been
unsatisfying.
All in all, I think the best solution would be the one I wrote in my
last reply to this list:
create an index on A in the direction you want in order to return
the first 10 rows quickly.
Use the first 10 rows query as a derived table.
Select from that derived table and order by B.
I would like to know if this helps :-)
With regards,
Martijn Tonies
Upscene Productions
http://www.upscene.com
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
http://www.databasedevelopmentforum.com
>>>I must have missed that one.No doubt you meant my responses... I agree I wrote things a bit
>
>> It's a reference to OP and others who expressed the belief
>> that because "other databases" [database engines] could do
>> it, Firebird should. [...]
>
> I guess that's why I missed it... to me the request seems very
> reasonable, and was not (directly) a criticism of Firebird.
>
> The OP stated that
> "select * from foo order by a, b"
> would use index (a,b) and return results in 0.01 seconds,
> and seemed very happy with that performance.
>
> What the OP wanted was to be able to get this statement:
> "select * from foo order by a desc, b"
> to operate with similar performance.
>
> On the surface this seems a very reasonable expectation, even
> when discussing Firebird.
"direct", so to speak, but I also said several times such an index
cannot be created while the OP continues to ask if it can be created.
In order to find a workaround, I asked why there should be a
resultset of millions of rows, to which the reply, I think, has been
unsatisfying.
All in all, I think the best solution would be the one I wrote in my
last reply to this list:
create an index on A in the direction you want in order to return
the first 10 rows quickly.
Use the first 10 rows query as a derived table.
Select from that derived table and order by B.
I would like to know if this helps :-)
With regards,
Martijn Tonies
Upscene Productions
http://www.upscene.com
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
http://www.databasedevelopmentforum.com