Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering versus Returning to Datasource

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
I have a standard gridview, with the standard paging and sorting interface enabled.
The application holds appointments for three organisational units, with a maximum of 3000 appointment records being returned across all three units. The appointment records are quite small.
The choice I am faced with is to:
1. Have an Org Unit dropdown which returns to the datasource on change of selection and at inital databind, and returns appointment records for one org unit at a time i.e. approx 1000 records.
2. Have the objectdatasource return all 3000 appointment records for all org units at initial databind, and filter the objectdatasource by org unit on change of selection, thereby saving a trip to the datasource.

I guess the question boils down to identifying the point at which querying the datasource by org unit is more efficient than filtering the records returned by org unit.


The risk with keeping an open mind is having your brains fall out.
Shaunk

 
Hi,
It depends ( isn't that a great answer !) -

The round-trip elapsed time for the 2 types of fetches can probably be measured - one factor

How quickly the dataset can filter on demand is one other factor when using the 3 Org dataset.

A very wise poster to these forums one said
wiseposter said:
One test is worth a thousand theories

Why not try it both ways and see what works best in your system?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
saving a few cycles avoiding calls to internal code is a waist of time. where you will get a preformance gain is reducing remote calls (IO, database, remote services, etc). efficient queries (proper indexing and simple queries). and manageable sets of data.

show 100s of records at once to the user doesn't provide value. they are only concerned with a handful of records at a time. processing 100s of records is typically an automated, offline process which can process sets of data in batches.

a dropdown will 1000 options is not a good idea. an auto-complete box would be a much better solution that can provide the user with a subset of options as they type.

then displaying that information you can page the data displaying 10-20 rows at a time (rather than 3000). by only returning the 10-20 results from the database along with the total number of actual rows you can build the UI to
1. search
2. display a page of data
3. allow the user to page the data
now you cannot do this out of the box with webforms. istead you will need to write some html, javascript, and .net code. The end result is a higher throughout as the code has to process much less data.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
I understand from the replies that I had misunderstood the way filtering works.
It appears that(without caching enabled), the gridview does a databind when the user selects a different filtering option i.e it runs the select method of the objectdatasource again.
This doesn't seem useful to me. What I want is for the datasource to return a certain amount of records, based on parameter selection, and when an event happens that applies a filterexpression, it just filters the gridview datasource on the client i.e. without doing another databind.
I would obviously have to homebake a solution for this to happen, involving databinding in code etc.
I know how to limit the number of records by using select parameters, but what I want is to filter those records again on the client using other fields.
I hope that makes sense.

The risk with keeping an open mind is having your brains fall out.
Shaunk

 
What do you hope to gain with client side filtering and/or caching? If we can understand your reasoning for this approach we can help with a solution.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
I would like filtering to work differently than it currently does. Out of the box, when a filterexpression is applied (and caching is disabled), it runs the select method of the ODS again, and then applies the filterexpression to the returned result.
I would like it to apply the filterexpression to the data returned on initial databind, without running the select method again.
This is not how it works, so I am aware I have to build a custom paging, sorting and filtering interface that returns only a page of data at a time.
I have resources I can refer to here, including Scott Mitchell's data tutorials and this link:

Thanks

The risk with keeping an open mind is having your brains fall out.
Shaunk
 
you are on the right track with Scott Mitchell's tutorial. However I'm still confused by the statement
I would like it to apply the filterexpression to the data returned on initial databind, without running the select method again.
every request back to the server will require a call against the database. the efficiency is gained by reducing the amount of data returned from the database, not reducing the number of times you query the database.

As a side note, I would loose the DataSource control altogether and simply code against the grid
Code:
Grid.DataSource = GetData();
DataBind();
this way you can debug your code.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top