views:

148

answers:

5

I have an application that holds data referencing 300,000 customers. When a user did a search the result was often bigger than our MaxRequestlength would allow, we have dealt with this in two ways: We have increased our MaxRequestLength to 102400 (KB) and required the user to supply two letters of the first Name and two letters of the last name, to limit the sheer # of customer records returned. This keeps us from exceeding the MaxRequestLength limit.

I was just wondering if anyone had any insight in to whether this was a particularly good approach, whether there is a limit to how big MaxRequestLength could be or should be, and what other options might be useful in this situation.

+2  A: 

I would recommend paging the results instead of displaying everything. I would also suggest adding multiple search fields allowing your users to filter their results even further. This will allow your user to find what they are looking for faster.

jrummell
We do have the multiple search fields but we don't "make" the users use them. if they don't and just click search I have larger data sets.And we are paging the results, on the client, but that doesn't help for this. And using Oracle, paging on the server is problematic.
Ken Lange
I would there is a way to reliably page in Oracle. If not, you could filter the result set after you've hit the database but before you send it to the client. For example, if you fill a DataTable, you can apply a row filter before binding it to a DataGrid.
jrummell
*"I would hope there is a way ..." I wish you could edit SO comments because I hardly ever catch typos before I click Add Comment.
jrummell
copy old comment + paste into new comment + make changes and save + delete old comment = edit.
Robert Harvey
@Robert - that does indeed work, but fewer steps would be nice :)
jrummell
+5  A: 

Most web applications I have seen deal with this by returning a paginated list, and displaying only the first page of results.

In modern implementations using ORM's, "Skip" and "Take" operators are used to retrieve only those records which are required for a given page.

So any given request is no longer than the number of records on one page.

Robert Harvey
We use Oracle. My Understanding is Skip and Take don't work so well with Oracle.
Ken Lange
I'm using the "skip" and "take" operators merely as illustrations. In your case you would either use Oracle-specific versions of these operators, or the ORM (if it is designed to be used with Oracle) would abstract them out for you, using its own version of the "skip" and "take" operators.
Robert Harvey
Here's a good article on pagination in Oracle: http://www.oracle.com/technology/oramag/oracle/07-jan/o17asktom.html
Robert Harvey
A: 

If your requirements allow it, I would suggest implementing server-side paging. That way you only send one page worth of records over the wire rather than the entire record set.

Stephen Mesa
+1  A: 

As you can guess from my comment, I think MaxRequestLength only restricts the size of the request (-> the amount of data sent from the client/browser to the server).

If you are exceeding this limit, then this probably means that you have a huge ViewState which is sent with every response. ViewState is stored in a hidden field on the page and is sent back to the server with every PostBack (and that's where the MaxRequestLength setting could come into play). You can easily check this by looking at the source of your page in the web browser and looking for a hidden INPUT element with the name "__VIEWSTATE" and a large string-value.

If this is the case, the you should try to reduce the size of the ViewState, e.g. by

  • setting ViewState="false" on your controls (GridView or whatever) and re-binding the control on every PostBack (this is the recommended approach)
  • storing the ViewState on the server side
  • compressing the ViewState
M4N
That makes sense!
tuinstoel
A: 

300,000 records is a completely unusable result set from a human perspective.

As others have said, page the results to something like the top 50 or 100 records. Let them sort it and provide a way to narrow the search criteria.

For perspective, look at google. They default to 10 records per page. Part of the reason for this is that people would rather provide more criteria than go spelunking through a large result set.

Chris Lively