Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > BindingSource.Filter slow
 

BindingSource.Filter slow

Hi!

I have a BindingSource which has a DataSet as it's datasource. The DataMember property of the
BindingSource is set to a table in the DataSet which contains about 360000 rows. When I set the
Filter property to e.g. "Name LIKE '%a'" it takes about three to five Minutes till the filtering
completes. When using the Select method of the DataTable, it only takes six seconds. I've
already tried things like setting RaiseListChangedEvents to false, calling SuspendBinding(),
but to no avail. It doesn't make a difference whether the BindingSource is databound or not.

Why is this and is there a way to speed up the filtering?
DennisG3  Thursday, March 22, 2007 1:25 PM
By default, filter is done after all data has been retieved, in the memory. So, if there're millions of records, it'll be very slow and also occupies a lot of memory. You can try to filter at the database level using the where clause. This can improve the performance a lot.
Zhi-Xin Ye  Friday, March 23, 2007 9:18 AM
360000 is really a big number, why not query in DataBase and refill the datagrid?
Bob zhu - SJTU  Friday, March 23, 2007 8:18 AM
By default, filter is done after all data has been retieved, in the memory. So, if there're millions of records, it'll be very slow and also occupies a lot of memory. You can try to filter at the database level using the where clause. This can improve the performance a lot.
Zhi-Xin Ye  Friday, March 23, 2007 9:18 AM
Bob zhu - MSFT wrote:
360000 is really a big number, why not query in DataBase and refill the datagrid?


Because I'd like to avoid another round-trip to the database. The filtering is done immediately after the user presses a key (like "Find as you type" in Firefox) and as the client gets it's data over the an Internet, I'd like to avoid transferring the whole data each time the user applies a filter. DataTable.Select() only needs about six seconds to retrieve the data, which would be perfectly fine, but I thought there would be a way to avoid writing additional code for that.



DennisG3  Saturday, March 24, 2007 2:36 PM

You can use google to search for other answers

Custom Search

More Threads

• Databinding problem with DataGridView/DataTable - Why is the binding not done immediatly after setting DataGridView.DataSource?
• ToolTips on DataGridView Column/cells
• UserDeletingRow fires four/five times
• Problem With Data Configuration Wizard and Forms with Generics
• DataGridview not immediately updating on textbox change
• Auto-resize and wrap text in cells
• Datagridview and AcceptChanges
• How to obtain a datarow object from the current selected datagrid row?
• Datasource is not updating when using DataGridView BeginEdit ... etc
• DataGrid Displaying two Tables