Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread index and speed
Fri, May 19 2006 11:57 AMPermanent Link

"Harry de Boer"
LS

Given the table vh2 where the fields jaar and maand are of type integer and
the sql expression is:
select distinct jaar, maand from vh2 order by jaar, maand
what would be better (faster): seperate indexes on each field or one
combined index (with the two fields).

I could have tried it -I know-but I want to know why one of of them -if so-
is faster too. Maybe one could give me some info about when to use combined
indexfields in an index (or point me to an article).

Any help would be great!

Regards, Harry

Fri, May 19 2006 2:05 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Harry


I'm sure that someone will correct me. My understanding is that DBISAM only uses the first field of an index in the selection process (it might refer specifically to the WHERE clause and have nothing to do with DISTINCT) so to optimise performance on the selection you need two indices. However, on the ORDER BY it will (I think) use compound indices. I could be wrong and that might only apply to tables.

My best guess is two separate indices will be best all round.

Roy Lambert
Fri, May 19 2006 5:55 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< I'm sure that someone will correct me. My understanding is that DBISAM
only uses the first field of an index in the selection process (it might
refer specifically to the WHERE clause and have nothing to do with DISTINCT)
so to optimise performance on the selection you need two indices. However,
on the ORDER BY it will (I think) use compound indices. I could be wrong and
that might only apply to tables. >>

You are 100% correct.  The optimization rules are here:

http://www.elevatesoft.com/dbisam4d5_optimizations.htm

--
Tim Young
Elevate Software
www.elevatesoft.com

Image