Subject | Re: index desc |
---|---|
Author | Adam |
Post date | 2006-08-02T23:48:45Z |
--- In firebird-support@yahoogroups.com, bill_lam <bill_lam@...> wrote:
a max, or a first n in your select.
If you do want to use an indexed sort (again only advised in the case
of min, max, or first n), then you will need to declare both.
The overheads of an indexed read tend to be higher than the overhead
of an in memory sort.
less time than it took for you to type this paragraph.
Adam
>have to use 2
> Suppose I am going to select in both ascending and desending order.
>
> select * from foo order by a
> select * from foo order by a desc
>
> Is only one index for ascending order (default) sufficient, or I
> index, one ascend and the other desc?I would suggest you use no index for ordering, unless there is a min,
> create index foo_a on foo(a)
> create desc index foo_a_d on foo(a)
a max, or a first n in your select.
If you do want to use an indexed sort (again only advised in the case
of min, max, or first n), then you will need to declare both.
The overheads of an indexed read tend to be higher than the overhead
of an in memory sort.
> Also is it possible to create a composite index on some ascendingcolumn and
> some descending column, like equivalent ofThat would take you a whole 10 seconds to find out via experiment,
> create index foo_inx on foo(a , b desc, c)
less time than it took for you to type this paragraph.
Adam