Subject RE: [firebird-support] Re: 'select' with delays ref/eDN5012844953
Author Helen Borrie
At 12:01 AM 23/01/2007, you wrote:
>Hello Hellen
>
>
>
>Yes I have a descending index, I think I have mentioned it, it is external
>index (it is not included in the all key fields).

Don't get confused. An index has one or more keys.
A primary key is a constraint. It is supported by an automatically
created unique index.
A foreign key is a constraint, supported by an automatically created
non-unique index.
A unique key is a constraint, supported by an automatically created
unique index.

There is no such animal as an external index; although all indexes
are maintained on pages separate from the tables' data pages.

>Let me ask you this:
>
>Suppose that we have the key fields key1, key2, and key3
>
>And I want order by 4th field the key0 descending.

I can't state categorically that I understand the question...

Do you mean you have a composite primary key consisting of three keys?

I do not understand the second part of the question.

>Is the follow index structure correct?
>
>Index key1, key2, key3 asc

You can have a composite ascending index across 3 fields, yes.

>Index key0 desc

You can have a descending index on one field, yes.

>What about this? (I think that doesn't cover our problem)

Which problem is that? I thought it was slowness in a query that was
ordered by a date field in descending order. The suggested answer to
that speed up the *ordering* part of the operation, you needed a
descending index on that field.

>Index key0, key1, key2, key3 desc
>
>All keys in the same index descending putting the key0 first

Yes. But that index won't be useful unless you need it for something.

./heLen