c# DataTable.Select LIKE statement performance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cappamontana
    New Member
    • Sep 2007
    • 21

    c# DataTable.Select LIKE statement performance

    Hi,

    I have a question for those who have some experience with select LIKE statements on huge data (about 200 million rows).
    When I run some computing and filtering on this table, it takes the code about 2 seconds to report back. But when I put a LIKE filter in the DataTable.Selec t() it suddenly takes 38 seconds. This only happens when I use a LIKE statement, any other statement is no problem.

    Do you guys have any idea how to tweak this?

    The DataTable is filled from a DataSet that is filled from a MySQL database.
  • Cappamontana
    New Member
    • Sep 2007
    • 21

    #2
    Solution:

    Tweaked it by delegating the LIKE statement to another (self-written) function that turns back true or false. This reduced the same query back to about 4 seconds.

    DataRow[] nbr_in_path_dr = ed_ds.Tables["ed"].Select("id='" + conversion["even_distribut ion_id"].ToString() + "' AND " + overviewType + "='" + ovt_r[overviewType].ToString() + "' "+
    //codeLineSql +
    ((keywordgroup_ id == "NOT_GIVEN" ) ? " " : "AND keywordgroup_id ='" + keywordgroup_id + "' "),);

    if (filtersSet == true)
    {
    foreach (DataRow row in nbr_in_path_dr)
    {
    if (ct2_queryAnaly zer(filters, row, "")) nbr_in_path++;
    }
    }
    else nbr_in_path = Convert.ToDoubl e(nbr_in_path_d r.Count());

    Comment

    Working...