hi, i'm using the berkeley db for .net 2.0. i would like to ask if you have a c# sample code of a function that performs a range search of data by specifying a start key and an end key. for ex. i want to get key 4,5,6 from the database containing 1,2,3,4,5,6,7,8,9,..., the start key is 4 and the end key is 6. thanks you very much!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
will it not be efficient? because if we have a table containing million of records and we are performing linear or forward search and the starting range is somehow located at the near end. is there a way that we can point the cursor at the starting range and then do a forward search until it reaches the ending range? thank you very much...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That is what I meant. First you point the cursor at the range start, using the GetAt() method with the appropriate GetAtMode value (see the official BDB docs) then you iterate.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi, i'm using the berkeley db for .net 2.0. i would like to ask if you have a c# sample code of a function that performs a range search of data by specifying a start key and an end key. for ex. i want to get key 4,5,6 from the database containing 1,2,3,4,5,6,7,8,9,..., the start key is 4 and the end key is 6. thanks you very much!
AFAIK, the only way to do this with BDB is to do a regular forward search, and compare each retrieved record against the end of range condition.
will it not be efficient? because if we have a table containing million of records and we are performing linear or forward search and the starting range is somehow located at the near end. is there a way that we can point the cursor at the starting range and then do a forward search until it reaches the ending range? thank you very much...
That is what I meant. First you point the cursor at the range start, using the GetAt() method with the appropriate GetAtMode value (see the official BDB docs) then you iterate.
thank you very much for the input. have a nice day! =)