473,799 Members | 3,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.

GetListOfFilesI nUseByDB

GetListOfFilesO nServer

for each File in GetListOfFilesO nServer
if File not in ListOfFilesInUs eByDB
deleteFileFromS erver
end if
next

I guess what I'm trying to find out the most efficient way to do that 'not
in ListOfFilesInUs eByDB'. 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 16418
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.f ind
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******** *****@tk2msftng p13.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.

GetListOfFilesI nUseByDB

GetListOfFilesO nServer

for each File in GetListOfFilesO nServer
if File not in ListOfFilesInUs eByDB
deleteFileFromS erver
end if
next

I guess what I'm trying to find out the most efficient way to do that 'not
in ListOfFilesInUs eByDB'. 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
408
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 fastest? I don't think the ReadXMLSchema would give a lot of difference, but maybe the overlaods of ReadXml and WriteXml will. Especially with larges files/datatables... Should I use the IO.Stream? The XmlReader/XmlWriter?
60
49203
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 be indexed/sorted. I don't want to load the entire file into physical memory, memory-mapped files are ok (and preferred). Speed/performance is a requirement -- the target is to locate the string in 10 seconds or less for a 100 MB file. The...
11
3623
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 million lines. b) I need to store the contents into a unique hash. c) I need to then sort the data on a specific field. d) I need to pull out certain fields and report them to the user.
2
1748
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 another dataset but with selection of datarows. Please Help!
3
1793
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 string arrays, which are just lists of people or companies in alphabetic order. These names may have accented and umlauted characters (which are present as the plain ASCII - not as the entity &# character). The page is UTF-8 encoded. e.g. ...
1
2432
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 string arrays, which are just lists of people or companies in alphabetic order. These names may have accented and umlauted characters (which are present as the plain ASCII - not as the entity &# character). The page is UTF-8 encoded. e.g. ...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10484
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.