How to deal with big query result?

L

Lin Ma

Greetings,

In my search application, user can type a number to search. I use LIKE in my
query.

If a query result generates over 10,000 recordsets, it may several minutes
to run.

Is there a way to only query certain recordset at a time?

I found in SQL you can use "TOP". Like select TOP 100.... it will return
only top 100 records.

Is there a way to query may be from 101 to 200 then from 201 to 300...

My query is like: Select * from Product where PartNumber like '%" PartNumber
"%'

Any idea is welcome.

Thanks a lot.

Lin Ma
 
A

Aaron Bertrand - MVP

Yes Lin, this is called "paging"

http://www.aspfaq.com/2120
http://www.aspfaq.com/2352

The use of a temp table to divide all of the records tends to scare people.
Typically, much of the processing time is in transferring the data over the
network and rendering the HTML required to display the data, than the
initial filtering. So give that method a shot.

Also, if a query returns 10,000 rows, you might consider requiring that the
user narrow it down a bit better... e.g. picking categories, or only
choosing results that start with one letter at a time, or ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,126
Messages
2,570,750
Members
47,307
Latest member
Wimble

Latest Threads

Top