Subject | Re: [firebird-support] Indexes automatically used? |
---|---|
Author | Alexandre Benson Smith |
Post date | 2005-08-12T16:33:48Z |
Clay,
Clay Shannon wrote:
it's think it should.
Remember, not all indices are good !
If the engine chooses to use an index for an ordered navigational scan
the first row will prompts quickly, but the total time tends to be
greater than if it reads the page in natural order and then sort in memory.
A sort in memory is extremelly fast !
Think for indices for the where clause not the order clause. As always
there are exceptions for this rule !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.4/66 - Release Date: 09/08/2005
Clay Shannon wrote:
>I've added several indexes to my database. Do these take effectNothing to do on the Delphi code, the optimizer should use an index if
>automatically when queries are run, or do I have to activate the indexes in
>my Delphi code before calling the stored procs that query the db?
>
>
>
it's think it should.
Remember, not all indices are good !
>Indices are better to filter the result set than to order it...
>
>Also, I have one query that does this:
>
>
>
>Order by sort_order, empno, shiftdate, created desc
>
>
If the engine chooses to use an index for an ordered navigational scan
the first row will prompts quickly, but the total time tends to be
greater than if it reads the page in natural order and then sort in memory.
A sort in memory is extremelly fast !
Think for indices for the where clause not the order clause. As always
there are exceptions for this rule !
>see you !
>
>Should I have four different indexes to speed up this query, or one
>composite index?
>
>
>
>Clay Shannon,
>
>Dimension 4 Software
>
>
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.4/66 - Release Date: 09/08/2005