473,327 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Is it possible to access a row in a datatable in constant time?

Is there a way to configure\create a datatable (strongly typed or untyped)
that can have a row accessed in constant time if you are searching on the
primary key?

If there isn't a way, then what is the quickest way to access a row when
using datatables?

Thanks,

Ryan

Jul 13 '07 #1
5 1669
I don't believe it is possible to guarantee processing time in Windows
environment.

Because search time depends on data size you can't guarantee constant time
when searching either. You can hope to have more or less same time when your
data has fixed size. But there will be no guarantee.

I believe fastest way is by row index. But also no guarantee for processing
time.
"Ryan Andrus" <Ry********@discussions.microsoft.comwrote in message
news:97**********************************@microsof t.com...
Is there a way to configure\create a datatable (strongly typed or untyped)
that can have a row accessed in constant time if you are searching on the
primary key?

If there isn't a way, then what is the quickest way to access a row when
using datatables?

Thanks,

Ryan

Jul 13 '07 #2
I don't believe it is possible to guarantee processing time in Windows
environment.
arrays don't provide constant access time? that seems wrong to me. I think
it is possible, if nothing else you could do it in unmanaged C++ but I would
be very supprised if arrays didn't offer constant time access.
I believe fastest way is by row index. But also no guarantee for processing
time.
can someone please at least speak to the Big O analasys of this access or
point me to what algorythm is used so that I can calculate it. Is it a b
tree, linked list, etc...

thanks
"AlexS" wrote:
I don't believe it is possible to guarantee processing time in Windows
environment.

Because search time depends on data size you can't guarantee constant time
when searching either. You can hope to have more or less same time when your
data has fixed size. But there will be no guarantee.

I believe fastest way is by row index. But also no guarantee for processing
time.
"Ryan Andrus" <Ry********@discussions.microsoft.comwrote in message
news:97**********************************@microsof t.com...
Is there a way to configure\create a datatable (strongly typed or untyped)
that can have a row accessed in constant time if you are searching on the
primary key?

If there isn't a way, then what is the quickest way to access a row when
using datatables?

Thanks,

Ryan


Jul 13 '07 #3
You need to factor in other processes and threads, OS kernel etc.. Any
thread could be interrupted at arbitrary moment.
"Ryan Andrus" <Ry********@discussions.microsoft.comwrote in message
news:34**********************************@microsof t.com...
>I don't believe it is possible to guarantee processing time in Windows
environment.

arrays don't provide constant access time? that seems wrong to me. I think
it is possible, if nothing else you could do it in unmanaged C++ but I
would
be very supprised if arrays didn't offer constant time access.
>I believe fastest way is by row index. But also no guarantee for
processing
time.

can someone please at least speak to the Big O analasys of this access or
point me to what algorythm is used so that I can calculate it. Is it a b
tree, linked list, etc...

thanks
"AlexS" wrote:
>I don't believe it is possible to guarantee processing time in Windows
environment.

Because search time depends on data size you can't guarantee constant
time
when searching either. You can hope to have more or less same time when
your
data has fixed size. But there will be no guarantee.

I believe fastest way is by row index. But also no guarantee for
processing
time.
"Ryan Andrus" <Ry********@discussions.microsoft.comwrote in message
news:97**********************************@microso ft.com...
Is there a way to configure\create a datatable (strongly typed or
untyped)
that can have a row accessed in constant time if you are searching on
the
primary key?

If there isn't a way, then what is the quickest way to access a row
when
using datatables?

Thanks,

Ryan



Jul 13 '07 #4
On Fri, 13 Jul 2007 08:14:04 -0700, Ryan Andrus
<Ry********@discussions.microsoft.comwrote:

>can someone please at least speak to the Big O analasys of this access or
point me to what algorythm is used so that I can calculate it. Is it a b
tree, linked list, etc...
Are you familiar with Lutz Roeder's Reflector? It allows you to
decompile assemblies, including the supplied .Net ones, and examine
the code. The DataRowCollection is implemented in terms of a red-black
tree.
--
Philip Daniels
Jul 13 '07 #5
Thanks Philip,

So, as far as you know is DataTable.Row[<index>]

The quickest access method resulting in O(log n) complexity?

"Ph***********@foo.com" wrote:
On Fri, 13 Jul 2007 08:14:04 -0700, Ryan Andrus
<Ry********@discussions.microsoft.comwrote:

can someone please at least speak to the Big O analasys of this access or
point me to what algorythm is used so that I can calculate it. Is it a b
tree, linked list, etc...

Are you familiar with Lutz Roeder's Reflector? It allows you to
decompile assemblies, including the supplied .Net ones, and examine
the code. The DataRowCollection is implemented in terms of a red-black
tree.
--
Philip Daniels
Jul 13 '07 #6

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

Similar topics

3
by: Josema | last post by:
Hi, I would like to know how fill a datatable from a two dimensional array. Any advice will be grateful. -- Thanks a lot. Regards.
15
by: Marcus | last post by:
I created a VB.Net 1.1 application that iterates through all the tables in any basic Access 2000 database passed to it and generates the same table structure in a SQL Server Express database. The...
3
by: Tigger | last post by:
I have an object which could be compared to a DataTable/List which I am trying to genericify. I've spent about a day so far in refactoring and in the process gone through some hoops and hit some...
4
by: oopman2002 | last post by:
I have created a DataSet DataTable which is comprised of data from a number of sources. The resultant datatable is about 500,000 records and writing them out one at a time takes forever. Does...
0
by: =?Utf-8?B?UnlhbiBBbmRydXM=?= | last post by:
Is there a way to configure\create a datatable (strongly typed or untyped) that can have a row accessed in constant time if you are searching on the primary key? If there isn't a way, then what...
7
by: =?utf-8?B?5YiY5piK?= | last post by:
Hi, folks, Is it possible to delete an element from a sorted array with O(1) time? Best regards
3
by: Martin Frey | last post by:
Hello guys, im new to asp.net and im trying to get me used to it. I've managed to create webpages with detailviews, databinding and datasources. Adding or inserting data went very well and, after...
10
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi, Problem: How can I databind (or put) a SqlServer query's row return of 115,000 items into a ComboBox quickly? Not much longer than a matter of seconds, that is... Scenario: I am...
5
by: yarivot26 | last post by:
I'm using ODBC to read a office access db the db have almost 10,000 rows so I want to split it into pages The first page load nice and quick, but in other pages i get: Maximum execution time...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.