PC Review


Reply
Thread Tools Rate Thread

DataView.Rowfilter performance

 
 
Joe
Guest
Posts: n/a
 
      11th Dec 2005
I have a RowFilter which is doing a not in (). The not in contains 600 items
for a single column. For example RowFilter = "ADate not in (600 DateTimes)".
This takes several seconds to run.

Is there a better way to handle this?


 
Reply With Quote
 
 
 
 
Adrian Moore
Guest
Posts: n/a
 
      12th Dec 2005
Joe,

You might be able to improve performance if you also sort on the AData
field, i.e.

..Sort = "ADate"

If not, you're better off keeping the 600 DateTimes in a list and using a
loop to delete non-matching rows in the view, for example,

dataview.Sort = "ADate"
For each row as DataRowView in dataview
Dim date as DataTime = Row("ADate")
Dim found as Boolean = False
For each val as DateTime in DateList
if date = val then
found = true;
exit for
end if
next
if not found then row.Delete
Next

Of course, storing the 600 DateTimes in a sorted list or indexed view could
speed this algorithm.

Hope this helps
Ad.


"Joe" <(E-Mail Removed)> wrote in message
news:%23b0jkep$(E-Mail Removed)...
>I have a RowFilter which is doing a not in (). The not in contains 600
>items for a single column. For example RowFilter = "ADate not in (600
>DateTimes)". This takes several seconds to run.
>
> Is there a better way to handle this?
>



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      12th Dec 2005
Adrian,

I doubt that this will speed up in version 1.x. Deleting is terrible slow in
that version.

Deleting was one of the goals to improve for 2.0

An anlternative from your routine can be to create a new table in 1.x
because that has no performance isues.

Just as addition.

Cor


 
Reply With Quote
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      12th Dec 2005
Hi Joe,

Welcome to MSDN newsgroup!

For your current issue, I agree with Adrian's suggestion. The performance
mainly is influenced by the indexing. So if you call sort method before
using RowFilter, I think maybe the performance will be improved. The below
sample from MSDN document demonstrate above description:
view.RowFilter = "City = 'Berlin'";
view.RowStateFilter = DataViewRowState.ModifiedCurrent;
view.Sort = "CompanyName DESC";
// Simple-bind to a TextBox control
Text1.DataBindings.Add("Text", view, "CompanyName");

If you have any concern, please let me know.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
Joe
Guest
Posts: n/a
 
      12th Dec 2005
I'll give it a shot.
BTW - It seems the performance is much worse when the values are DateTime.
If I was doing the same with a regular string column and values, the
RowFilter is much quicker.

""Yuan Ren[MSFT]"" <v-(E-Mail Removed)> wrote in message
news:bGGIu4v$(E-Mail Removed)...
> Hi Joe,
>
> Welcome to MSDN newsgroup!
>
> For your current issue, I agree with Adrian's suggestion. The performance
> mainly is influenced by the indexing. So if you call sort method before
> using RowFilter, I think maybe the performance will be improved. The below
> sample from MSDN document demonstrate above description:
> view.RowFilter = "City = 'Berlin'";
> view.RowStateFilter = DataViewRowState.ModifiedCurrent;
> view.Sort = "CompanyName DESC";
> // Simple-bind to a TextBox control
> Text1.DataBindings.Add("Text", view, "CompanyName");
>
> If you have any concern, please let me know.
>
> Regards,
>
> Yuan Ren [MSFT]
> Microsoft Online Support
>



 
Reply With Quote
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      14th Dec 2005
Hi Joe,

Thanks for your reply!

>"If I was doing the same with a regular string column and values, the

RowFilter is much quicker."
Based on my understanding, if you change the condition to string value, the
performance has been improved obviously. My meaning is changing "RowFilter
= ADate not in DateTime object" to "RowFilter = "ADate not in string
object". If I have anything misunderstood, please let me know.

As far as I know, the DateTime object needs higher cost than string object
on the aspect of comparison. And then, I suggest you consider changing the
condition if you need high performance.

If you have any concern, please feel free to let me know, I'm looking
forward your reply!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dataview rowfilter Patrice Lamarche Microsoft ADO .NET 4 23rd Nov 2005 08:48 PM
DataView - RowFilter Daniel Groh Microsoft C# .NET 2 22nd Apr 2005 12:01 AM
DataView.RowFilter Magne Ryholt Microsoft ADO .NET 2 4th Aug 2004 09:27 AM
DataView RowFilter Ryan Moore Microsoft ASP .NET 2 30th Jul 2004 11:11 PM
DataView RowFilter Mike Microsoft ADO .NET 1 27th Jul 2004 11:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:24 PM.