Wilfried Mestdagh wrote:

Hi,

I'm a little confused how to create indexes. (beginners question, but I
could not find or understeand clearly in FAQ). I have on a table
following 3 selects:

'select distinct Name ' +
 'from Rx ' +
 'where RxDT >= ' + DT + ' ' +
 'order by Name'

'select * ' +
 'from Rx ' +
 'where RxDt >= ' + DT + ' ' +
 'order by ID, RxDT desc'

'select * ' +
 'from Rx ' +
 'where RxDt >= ' + DT + ' and ReportType = ' + RT + ' ' +
 'order by ID, RxDT desc'

Can you please teach me whitch indexes I exacly have to make ? RxDT is
everywhere but I'm not sure if I have to make a separate index for it or
that I have to make just 3 separate indexes as I would do with a common
TDataSet for example ?  Do I have to make separate index for the DESC ?

---
Mvg, Wilfried
http://www.mestdagh.biz



Because you are compairing RxDT, that should be indexed for sure, in the third query you are also compairing reporttype. You could consider indexing that too.
If the result set from

RxDt >= is small, you will not have much profit form an index on Reporttype

The Order by's, in my opinion do not need an index, because it is only the resultset which is sorted

Bert

Reply via email to