Subject | Re: [firebird-support] Access in asc and desc order, index twice? |
---|---|
Author | Martijn Tonies |
Post date | 2005-09-16T14:55:51Z |
Hi,
A "desc" ORDER BY cannot use an ascending index.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
> To get the installments to pay in secuential order I have to queryIf there's no WHERE clause, a "descending" index could surely help.
> sorting by year asc and month asc
>
> But to get the last payed installemnt I have to query by year desc and
> month desc using a "select first 1"
A "desc" ORDER BY cannot use an ascending index.
> Both queries are done always one after the other in the same transaction.With regards,
>
> Should I index this table's year and month twice, once ascending and
> once descending to improve performance?
>
> This particlar table will not grow a lot. I expect less than 10 new
> records a month. Occationally some newly added record could be deleted
> by the user.
>
> This runs in FB 1.5.1, but I will move to FB 2 as soon as it is stable
> (you know FB 2 come with a lot of nice features and improvements).
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com