Click here to Skip to main content
12,897,945 members (83,560 online)
Click here to Skip to main content
Add your own
alternative version


4 bookmarked
Posted 1 Jul 2013

DataTable Merge Performance

, 1 Jul 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
This project measures performance of the DataTable.Merge method.


Two DataTables may be merged with the DataTable.Merge method. The performance of this method is very slow when the destination table has added rows. It is therefore recommended to call the method DataTable.AcceptChanges when the destination DataTable has added rows.

The Solution

  1. Open the DataTableMerge.vbproj with Visual Studio 2010, build and run it. The following form appears:

    Main form of DataTableMerge project

  2. In the textbox "Step" must be given the number of records by which each test is to be incremented.
  3. In the textbox "Max table size" must be given the total number of records of the last test.
  4. Press the button "Start". This will run the tests. Each test, times the merge operation of two DataTables (table T2 is merged into table T1, in VB.NET: T1.Merge(T2)). 4 combinations are tested:
    1. T1UnchangedT2Unchanged: On both tables, the method AcceptChanges has been called.
    2. T1UnchangedT2Added: On table T1, the method AcceptChanges has been called, records of table T2 are in RowState=Added.
    3. T1AddedT2Unchanged: Records of table T1 are in RowState=Added, on table T2 the method AcceptChanges has been called.
    4. T1AddedT2Added: Records of tables T1 and T2 are in RowState=Added.

    The third case (T1AddedT2Unchanged) is very slow, for 10000 records, it takes more than 2 minutes. All other cases seem to perform equally fast.


  • 28th June, 2013: Initial version


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Alexandros Pappas
Software Developer (Senior) Alpha Bank SA
Greece Greece
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 1 Jul 2013
Article Copyright 2013 by Alexandros Pappas
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid