472,378 Members | 1,316 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 software developers and data experts.

Fastest way to search a dataset.

UJ
I have a dataset that will have say 10000 records in it with the names of
files that are used by the system. I then have a large directory of files
that correspond to that list of files and want to find any files that are in
the directory but not referenced anymore (trying to do cleanup.) I know how
to do all of the stuff but am looking for opinions/suggestions on the
searching of the table. If you have say 10000 records, what's the fastest
way to find a record with a certain value. Here's a code snippet of what I'm
talking about.

GetListOfFilesInUseByDB

GetListOfFilesOnServer

for each File in GetListOfFilesOnServer
if File not in ListOfFilesInUseByDB
deleteFileFromServer
end if
next

I guess what I'm trying to find out the most efficient way to do that 'not
in ListOfFilesInUseByDB'. I know I could filter the datatable. I could also
do a Select on the datatable but since this could have a large number of
records, I wonder if there's a way to put an index on the datatable so it
will search faster....

Any thoughts would be appreciated.

J.
Nov 21 '05 #1
2 16179
UJ,

When you do this kind of operations it depends how many times do you have to
do it with the same datatable (you cannot search datarows in a dataset).

When you want to search more than is in my opinion probably the best
solution the rowcollection.find
http://msdn.microsoft.com/library/de...sfindtopic.asp

With on the second place the
Dataview.find
http://msdn.microsoft.com/library/de...sfindtopic.asp

The first returns a row the second an index inside the dataview.

I hope this helps,

Cor
Nov 21 '05 #2
10.000 is not so much

i would solve this with a Hashtable wich is as far as i know the one with
the highest search performance ( have seen some Balena test code and believe
me it is fast )
it looks to be ideal in your situation as it exposes a ContainsKey method
wich would hold in your situation the file name

if you do not have a value to store just put in a empty string var

happy coding

M. posseth




"UJ" <UJ@nowhere.com> wrote in message
news:eT*************@tk2msftngp13.phx.gbl...
I have a dataset that will have say 10000 records in it with the names of
files that are used by the system. I then have a large directory of files
that correspond to that list of files and want to find any files that are in the directory but not referenced anymore (trying to do cleanup.) I know how to do all of the stuff but am looking for opinions/suggestions on the
searching of the table. If you have say 10000 records, what's the fastest
way to find a record with a certain value. Here's a code snippet of what I'm talking about.

GetListOfFilesInUseByDB

GetListOfFilesOnServer

for each File in GetListOfFilesOnServer
if File not in ListOfFilesInUseByDB
deleteFileFromServer
end if
next

I guess what I'm trying to find out the most efficient way to do that 'not
in ListOfFilesInUseByDB'. I know I could filter the datatable. I could also do a Select on the datatable but since this could have a large number of
records, I wonder if there's a way to put an index on the datatable so it
will search faster....

Any thoughts would be appreciated.

J.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: DraguVaso | last post by:
Hi, I should use XML to synchronize the data from different (VB.NET) applications, and I was just wondering which Overloads of these functions ( ReadXmlSchema, ReadXml and WriteXml) goes the...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
11
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a...
2
by: Danny Ni | last post by:
Hi, I would like to know the fastest way to clone a dataset with filter inVB.Net or C#. Say I have a dataset that has one datatable having several data rows. I want to clone the structure to...
3
by: Harry Haller | last post by:
What is the fastest way to search a client-side database? I have about 60-65 kb of data downloaded to the client which is present in 3 dynamically created list boxes. The boxes are filled from 3...
1
by: Harry Haller | last post by:
What is the fastest way to search a client-side database? I have about 60-65 kb of data downloaded to the client which is present in 3 dynamically created list boxes. The boxes are filled from 3...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.