B
bryan.young
How can I force the creation of an index that will be used with the
DataTable.Select method?
I need to use the DataTable.Select because I'm doing a range select
ex: select all rows where column x is between 0.001 and 0.006
If I create a DataView with a sort on column x (and I'm told an index
is created then), the DataTable.Select method doesn't use it (ie, no
change in execution time). However, if I specify
DataTable.Columns("ColumnX").Unique = true, an index is definitely
used (from 3.5 minutes execution time to 6 seconds).
But I can't guarantee that Column X will be unique. How can I force
the creation of that index where I can use it in a range selection.
ex:
mydrs = dtErrorData.Select("ColumnX > " & CurrentSample.ToString & "
AND ColumnX < " & (CurrentSample + 0.05).ToString) ', "ColumnX ASC")
For Each mydr In mydrs
fColumnX = mydr("ColumnX")
do some stuff
Next
DataTable.Select method?
I need to use the DataTable.Select because I'm doing a range select
ex: select all rows where column x is between 0.001 and 0.006
If I create a DataView with a sort on column x (and I'm told an index
is created then), the DataTable.Select method doesn't use it (ie, no
change in execution time). However, if I specify
DataTable.Columns("ColumnX").Unique = true, an index is definitely
used (from 3.5 minutes execution time to 6 seconds).
But I can't guarantee that Column X will be unique. How can I force
the creation of that index where I can use it in a range selection.
ex:
mydrs = dtErrorData.Select("ColumnX > " & CurrentSample.ToString & "
AND ColumnX < " & (CurrentSample + 0.05).ToString) ', "ColumnX ASC")
For Each mydr In mydrs
fColumnX = mydr("ColumnX")
do some stuff
Next