473,480 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Comparision between Datatable's Select method and stored procedure

Hi,
Has any one ever compared the performance of calling a DataTable's
Select method with a stored procedure doing the same thing?
My point is:
dataRows = DataTable.Select(filter) is better or
Passing paramters to stored procedure?
The datatable holds about 500-700 rows at any given time.

If I select one of the approaches the business logic will go into
respective layers.With dotnet in picture what would be a good approach
- Have the data in Datatable and do a filter on the data or call
stored procedures which has been the convention.
Can some one pl. suggest?
Thanks
Nandan
Nov 16 '05 #1
3 5889
Just on the time for the Select, I would hope a stored procedure is better.
The database's optimization engine and indexing should be superior to
anything in a datatable.

Now, the only other factor in this, is that calling your stored procedure
would require the overhead of a connection, and getting the data transferred
from the DB server to your app. It is hard to predict what kind of
additional overhead that would take, since we don't know your setup.

You should probably do some tests to see which method is more efficient in
your situation.

"nandan" <ma****@hotmail.com> wrote in message
news:c7**************************@posting.google.c om...
Hi,
Has any one ever compared the performance of calling a DataTable's
Select method with a stored procedure doing the same thing?
My point is:
dataRows = DataTable.Select(filter) is better or
Passing paramters to stored procedure?
The datatable holds about 500-700 rows at any given time.

If I select one of the approaches the business logic will go into
respective layers.With dotnet in picture what would be a good approach
- Have the data in Datatable and do a filter on the data or call
stored procedures which has been the convention.
Can some one pl. suggest?
Thanks
Nandan

Nov 16 '05 #2
Hi Nandan,

Once you populate a DataTable, that data is held locally on the server
rather than in the database. So, my guess would be that filtering rows on
the DataTable would probably be faster than going back to the database to
execute a stored proc (YMMV).

The downside to this is that you have to take into account that the data may
not be the most up to date. For instance, if you are designing a stock
tracking website; during trading hours, the data in the DataTable could be
very different from what is in the database. In this instance, I would use
stored procs. But, if you are designing a shopping cart site with data that
does not change often, I would use a data table and perform all my filters
upon that rather than spend the extra bandwidth cost to go back and forth
from the database.

So, now that I have rambled on and on... the simple answer is that the
DataTable will most likely outperform the stored procedures. :-)

--
HTH

Kyril Magnos
"I'm not a developer anymore, I'm a software engineer now!" :-)

"nandan" <ma****@hotmail.com> wrote in message
news:c7**************************@posting.google.c om...
| Hi,
| Has any one ever compared the performance of calling a DataTable's
| Select method with a stored procedure doing the same thing?
| My point is:
| dataRows = DataTable.Select(filter) is better or
| Passing paramters to stored procedure?
| The datatable holds about 500-700 rows at any given time.
|
| If I select one of the approaches the business logic will go into
| respective layers.With dotnet in picture what would be a good approach
| - Have the data in Datatable and do a filter on the data or call
| stored procedures which has been the convention.
| Can some one pl. suggest?
| Thanks
| Nandan
Nov 16 '05 #3
If you need some performance is better use store procedure id DB, that mean
if you have a productive DB with a lot of select pro second, for example a
DB used from a web page with a lot of user.
I prefer to use a dataadpter with sql-parameters and fill a DataTable, it's
easier to change it if is needed.
To filter the resultrows I prefer to use a separated DataView also when the
DataTable has his personal DataView (DataTable.DefaultView)
I use the DataTable.Select method only to avoid to build relation between
tables (Constraint) and use the GetChildren method

"nandan" <ma****@hotmail.com> schrieb im Newsbeitrag
news:c7**************************@posting.google.c om...
Hi,
Has any one ever compared the performance of calling a DataTable's
Select method with a stored procedure doing the same thing?
My point is:
dataRows = DataTable.Select(filter) is better or
Passing paramters to stored procedure?
The datatable holds about 500-700 rows at any given time.

If I select one of the approaches the business logic will go into
respective layers.With dotnet in picture what would be a good approach
- Have the data in Datatable and do a filter on the data or call
stored procedures which has been the convention.
Can some one pl. suggest?
Thanks
Nandan

Nov 16 '05 #4

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

Similar topics

3
2108
by: nandan | last post by:
Hi, Has any one ever compared the performance of calling a DataTable's Select method with a stored procedure doing the same thing? My point is: dataRows = DataTable.Select(filter) is better or...
5
7940
by: Bhavna | last post by:
Hello I want to push the data in my datatable into my database. How must i do this? I have been told to create a insert query. I have done this and have a select statement below it to retrieve the...
5
9997
by: Stefan Turalski \(stic\) | last post by:
Hi, I'm wondering if there is a way to send a method parametrs by ref when DataTabel is a type of this value ? I done some sort of select over DataTable columns, just by removing them froma...
0
1076
by: Jason MacKenzie | last post by:
If have a stored procedure that seems to work fine through query analyzer but if I attempt the same thing via code, no exceptions are thrown but no results are ever returned. I'm using the ODBC.NET...
4
2805
by: Fred Nelson | last post by:
Hi: I have built and loaded a datatable with three columns and defined the first as a primary key as below: ' define datatable dim fvtable as new DataTable dim fvrow as DataRow...
1
1601
by: Jeff | last post by:
hey asp.net 2.0 Is it possible to send a System.Data.DataTable as a input parameter to a stored procedure (MS Sql Server)? Jeff
0
1758
by: Maart_newbie | last post by:
Hi all, I've got a question about returning the value of a pk-column to a DataTable after inserting a row (via a data-adapter) using MySql5. Here is the SQL and code concerned: ...
0
1403
by: Jeff | last post by:
..NET 2.0 I'm working on a .NET 2.0 project which are using a DataSet for all communication with the database. Here is the problem: I want to search a table based on a matching criteria (I...
3
2801
by: Nuno Magalhaes | last post by:
Hello, I have a DataTable in which the items are of type MyClass. How can I use Select to compare a MyClass instance with the DataTable? Is there any overriden method (like the ToString()) to...
0
6911
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...
0
7050
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,...
0
7091
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...
0
6966
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...
0
5344
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4787
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
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...

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.